Page 2 of 2

Re: GUIDE: Using Java 8 with SFS2X

Posted: 28 Oct 2015, 03:28
by aakture
You said "then launch SFS2X via start.sh", I think you meant "then launch SFS2X via sfs2x.sh", correct?

Re: GUIDE: Using Java 8 with SFS2X

Posted: 28 Oct 2015, 08:26
by Lapo
aakture wrote:You said "then launch SFS2X via start.sh", I think you meant "then launch SFS2X via sfs2x.sh", correct?

Yep sorry, you're right. Confused it with SFS PRO.
It is fixed now.

Thanks

Re: GUIDE: Using Java 8 with SFS2X

Posted: 16 Feb 2017, 04:59
by coolboy714cp
How do we upgrade the JRE now that SFS2X comes pre-packaged with Java 8 Runtime? For some reason The SFS2X/lib/jetty/modules/npn folder no longer exists.. SFS still starts though. There is a alpn-impl folder there instead though..?

Re: GUIDE: Using Java 8 with SFS2X

Posted: 16 Feb 2017, 08:24
by Lapo
Hi,
since version 2.12 you can just replace the JRE folder directly.
(Naturally the JRE must be version 8 or higher)

Hope it helps

Re: GUIDE: Using Java 8 with SFS2X

Posted: 20 Jun 2017, 11:37
by ManHo
My Expression
thanks for the blog very interesting
The easiest way to get up and running is simply to install Java 8 and then launch SFS2X via sfs2x.sh script in the terminal. There actually a total of 4 ways to launch SFS2X on the Mac :( Three of which depend on the embedded JRE and require further hacking into the shell scripts.
Thanks You!
gclub casino
goldenslot
gclub casino

Re: GUIDE: Using Java 8 with SFS2X

Posted: 03 Dec 2020, 16:45
by patman
Hello,

I am new to Smart Fox and spent the last month reading the documentation and going the through the various Unity tutorials available via the SFS2X docs found on the website. I didn't realize there was an Asset Package on the store until today :D but nonetheless everything worked relatively flawlessly.

However when I made my own extension I found the extension kept not being initialized. I found somewhere that the extension needs to be compiled with the JRE as Smart Fox. So I figured I just needed to update the jre but every time I replace the Smart Fox jre folder the server won't start back up again with a 1067 error. I had backed up the original jre folder incase I ran into problems so I was able to bring it back. After which my server can start up again.

Ultimately my questions are,

- am I going down the correct avenue here? The initial problem was the extension not being initialized. Would the fact that it was complied with Java 11 effect the initialization?

- If both of the previous questions are yes, What am I doing wrong? I followed the instructions 1 & 2 but when I do the server won't start again.

any help will great thank you!

Re: GUIDE: Using Java 8 with SFS2X

Posted: 03 Dec 2020, 17:12
by Lapo
Hi,
- am I going down the correct avenue here? The initial problem was the extension not being initialized. Would the fact that it was complied with Java 11 effect the initialization?

All you need to do is write the Extension code in a Java IDE (Eclipse, NetBeans, IntelliJ...) and compile it to a jar file, which then is deployed under the SFS2X/extensions/ folder.

Here's a step by step guide:
http://docs2x.smartfoxserver.com/Extens ... extensions

Would the fact that it was complied with Java 11 effect the initialization?

Yes.
SmartFoxServer 2X runs by default with Java 8, so Extension code compiled for a higher Java version will not work.
You have two options:

1- Set your compiler to be compatible with Java 8 (it's a setting found in the build options of every Java IDE)
2- Replace the default Java Runtime provided with SFS2X with a Java Runtime 11

Normally we recommend to use the former rather than the latter, but if you know what you're doing option 2 is also viable.

Hope it helps

Re: GUIDE: Using Java 8 with SFS2X

Posted: 03 Dec 2020, 20:33
by patman
Awesome,

Thanks!

I followed that guide to produce the initial jar files but thank you. I actually have your docs bookmarked at the moment for references.

Thank you for that I did not know that I could change that in the java IDE! I think this should work. thank you!

Re: GUIDE: Using Java 8 with SFS2X

Posted: 04 Dec 2020, 15:05
by patman
Forgot to thank you and say that it works now. My extensions are now being initialized by the server.

Thank You!

Re: GUIDE: Using Java 8 with SFS2X

Posted: 04 Dec 2020, 15:44
by Lapo
Great :)

Re: GUIDE: Using Java 8 with SFS2X

Posted: 20 Dec 2020, 21:50
by Luke64
Hi Lapo,

Lapo wrote:You have two options:

1- Set your compiler to be compatible with Java 8 (it's a setting found in the build options of every Java IDE)
2- Replace the default Java Runtime provided with SFS2X with a Java Runtime 11

Normally we recommend to use the former rather than the latter, but if you know what you're doing option 2 is also viable.


When starting SFS2X with most recent JRE 11.0.9 it issues a warning:

Code: Select all

$ ./sfs2x.sh
21:42:17,896 INFO  [main] v2.SmartFoxServer     - Boot sequence starts...
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.thoughtworks.xstream.core.util.Fields (file:/home/sfs2x/SmartFoxServer_2X/SFS2X/lib/xstream-1.3.1.jar) to field java.util.Properties.defaults
WARNING: Please consider reporting this to the maintainers of com.thoughtworks.xstream.core.util.Fields
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
21:42:18,419 INFO  [main] core.SFSEventManager     - SFSEventManager initialized


Of course it's just a warning, so I just wanted to pass it on in case you're thinking about updating that dependency anyway or so. ;)

Cheers!

Re: GUIDE: Using Java 8 with SFS2X

Posted: 21 Dec 2020, 10:45
by Lapo
Yes this expected and not an issue with any JRE version >= 9.
No worries.
As regards updating the dependencies, it's not going to happen for SFS2X. It's just way too much work, as too many features rely on pre-Java 9 reflection.

Cheers