Guide: How to compile a .jar file for your extension

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

User avatar
Lapo
Site Admin
Posts: 21723
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Guide: How to compile a .jar file for your extension

Postby Lapo » 16 Apr 2019, 14:41

Hi,
LordDawn wrote:I'm following the guide, I have the latest Java and Eclipse, and have written a demo hello world extension, but when I add the Jar file into the extensions/MyExtension folder, and restart the clean install of smartfox, it crashes out. I can't find any log that shows an error as to why this happens. Remove the extension jar file and it starts up fine (though issues a warning that the MyExtension folder contains no jar file.

Logs are found under SFS2X/logs/smartfox.log
Or you can start the server via the sfs2x.sh (OSX / Linux) / sfs2x.bat (Windows) from command line and see the logs live.
Or you can connect via the AdminTool and check the logs from the Log Manager

Find out what error you've got in the logs and let us know.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
LordDawn
Posts: 42
Joined: 15 Apr 2019, 08:36

Re: Guide: How to compile a .jar file for your extension

Postby LordDawn » 16 Apr 2019, 14:52

Here's the log file. I can't see anything, but it crashes out and auto-closes:-

16 Apr 2019 | 15:56:16,885 | INFO | main | smartfoxserver.v2.SmartFoxServer | | Boot sequence starts...
16 Apr 2019 | 15:56:19,459 | INFO | main | v2.core.SFSEventManager | | AnonymousService-1 initialized
16 Apr 2019 | 15:56:19,506 | INFO | main | vfs.impl.DefaultFileReplicator | | Using "C:\Users\Luke\AppData\Local\Temp\vfs_cache" as temporary files store.
16 Apr 2019 | 15:56:19,606 | INFO | main | smartfoxserver.v2.SmartFoxServer | | License loaded:

==========================================
LICENSE DETAILS
------------------------------------------
Type : Community Edition
Max users : 100
==========================================

16 Apr 2019 | 15:56:19,606 | INFO | main | entities.managers.SFSBannedUserStorage | | BanUserStorage initialized
16 Apr 2019 | 15:56:19,638 | INFO | main | entities.managers.SFSBannedUserManager | | BanUser data loaded: 0 records.
16 Apr 2019 | 15:56:19,653 | INFO | main | smartfoxserver.v2.SmartFoxServer | | Protocol Type is: BINARY
16 Apr 2019 | 15:56:19,738 | INFO | main | v2.config.DefaultConfigLoader | | Loading: zones\BasicExamples.zone.xml
16 Apr 2019 | 15:56:19,791 | INFO | main | entities.managers.SFSZoneManager | |

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
>> Zone: BasicExamples
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

16 Apr 2019 | 15:56:19,860 | INFO | main | entities.managers.SFSRoomManager | | Room created: { Zone: BasicExamples }, [ Room: The Lobby, Id: 0, Group: default, isGame: false ], type = SFSRoom
16 Apr 2019 | 15:56:19,892 | INFO | Thread-1 | entities.managers.SFSZoneManager | | BuddyList saveAll...
16 Apr 2019 | 15:56:19,892 | WARN | SFS2X ShutdownHook | v2.core.SFSShutdownHook | | SFS2X is shutting down. The process may take a few seconds...
16 Apr 2019 | 15:56:19,907 | INFO | Thread-2 | entities.managers.SFSBannedUserManager | | BanUser data saved.
User avatar
Lapo
Site Admin
Posts: 21723
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Guide: How to compile a .jar file for your extension

Postby Lapo » 16 Apr 2019, 16:37

Can you run the server from the terminal/prompt as I mentioned before?
Just to see if there's any extra information.

Also what SFS2X version are you running?
How big is the jar file you're using for the Extension?

Thanks
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
LordDawn
Posts: 42
Joined: 15 Apr 2019, 08:36

Re: Guide: How to compile a .jar file for your extension

Postby LordDawn » 17 Apr 2019, 07:47

Running from the command line, I get an error that my jar was compiled using Java runtime class file version 55 and SmartFox was compiled with Java runtime class file version 52.

I've found I can cure the error by changing compliance in Eclipse to 1.8. I tried 11, 10, 9 and all of those still caused the error, but 1.8 was ok.

Have I got this right, or should I be doing things another way?
User avatar
Lapo
Site Admin
Posts: 21723
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Guide: How to compile a .jar file for your extension

Postby Lapo » 17 Apr 2019, 09:19

Yes, that's correct. Just change the compliance so that your code is compatible with Java 8 and you should be fine.

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
User avatar
HTCraft
Posts: 27
Joined: 28 Jun 2018, 09:51
Location: Moscow, Russia
Contact:

Re: Guide: How to compile a .jar file for your extension

Postby HTCraft » 30 Nov 2019, 18:58

In Netbeans project tree you have to switch to tab Files, open file project.properties and change

from
build.dir=build

to
build.dir=...your...location...\\SFS2X\\extensions\\...your...subfolder...

from
dist.dir=dist

to
dist.dir=...your...location...\\SFS\\SFS2X\\extensions\\...your...subfolder...

If you have defined our extension in zone or room you need stop the SFS service before build your extension.
Good luck!

Return to “SFS2X Questions”

Who is online

Users browsing this forum: Aldenea, DavinVicy, DerikFent, Kevengar and 20 guests