[TUTORIAL] How to add new libraries (.jar files)

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

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

[TUTORIAL] How to add new libraries (.jar files)

Postby Lapo » 04 Oct 2007, 12:32

In order to add new libraries in the form of jar files to the SmartFoxServer runtime, you need to follow these steps:

1- copy the jar files into the Server/lib/ folder. If the library is made up of several jar files (for example Hibernate) you can create a subfolder (e.g. Server/lib/hibernate) and copy all those files there.

2- you need to tell the JVM to load the jar files by adding them in the classpath.
This can be done in different ways based on your OS and how you're running the server:

-> Running the server as service/daemon

You should open the conf/wrapper.conf file. In the classpath section add a new entry like this:

Code: Select all

wrapper.java.classpath.XX=/path-to-installation/Server/lib/filename.jar

Where XX is a progressive number. If you're using relative paths it will be slightly different:

Code: Select all

wrapper.java.classpath.XX=lib/filename.jar


-> Running the server standalone (start.sh or start.bat)

Linux/Unix: open the start.sh script with your favorite text editor and add the jar files to the classpath parameter. Make sure to separate each entry with a colon ( : ).

Windows: open the start.bat script with your favorite text editor and add the jar files to the classpath parameter. Make sure to separate each entry with a semi-colon ( ; ).

Once this is done you should stop the server if it's running and start it again
Last edited by Lapo on 14 Apr 2009, 08:28, edited 1 time in total.
Lapo
--
gotoAndPlay()
...addicted to flash games
giorgio79
Posts: 40
Joined: 14 Dec 2007, 19:32

cool

Postby giorgio79 » 22 Dec 2007, 13:03

Sounds cool :)

Would you have some example scenarios when one would add a jar extension?

For example, I have a java server for some games, could I add that as an extension?
jamieyg3
Posts: 84
Joined: 25 Sep 2008, 16:01

Postby jamieyg3 » 02 Nov 2008, 03:55

I spent about 2 full days trying to get an external jar file to work (jdom for reading xml files) without success, and then i gave up, and now i find this thread. should have looked here earlier.
corwin
Posts: 77
Joined: 17 Jul 2009, 08:19

Postby corwin » 03 Nov 2009, 10:57

Hi, is it possible to reload used jar/java project runtime? With the described scenario you need to restart the server to reload jars, which is pretty uncomfortable.
User avatar
Lapo
Site Admin
Posts: 19645
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 03 Nov 2009, 14:01

It is possible to reload extensions at runtime, but not jar files.
Extensions can be deployed directly to the javaExtensions folder.

I'd recommend to follow the documentation here:
http://www.smartfoxserver.com/docs/docP ... ons.htm#9a

Runtime reloading of jar file is coming in the next major update, due next year.
Lapo

--

gotoAndPlay()

...addicted to flash games
corwin
Posts: 77
Joined: 17 Jul 2009, 08:19

Postby corwin » 04 Nov 2009, 08:33

Ok, thanks for the info.
PeredereevBoris
Posts: 16
Joined: 09 Aug 2010, 13:49

Unix

Postby PeredereevBoris » 18 Aug 2010, 12:27

When You add library onto start.sh be attentive after last library also should be ":" symbol
Onlyzen
Posts: 2
Joined: 22 Jul 2017, 11:31
Location: United States

Re: [TUTORIAL] How to add new libraries (.jar files)

Postby Onlyzen » 08 Nov 2017, 08:38

its Good and thanks for information

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 3 guests