Page 1 of 3

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

Posted: 31 Jul 2010, 11:49
by BigFIsh
Guide is based on NetBeans 6.8 IDE

1. Download & Install latest JDK 6
2. Open NetBeans, add a new Java Class Project.
3. Add required SFS .jar libraries
4. Right click on your project and change the Source/Binrary Format to JDK 6
5. Modify the build.xml file, and add the following to -post-compile (it will copy the .jar file to the SFS2X directory after the compile):

Code: Select all

<copy todir="{SFS2X path}\SFS2X\extensions\{your extension}\">
   <fileset file="${dist.jar}"/>
</copy>


6. Restart your server (in order for the server to pick up the new .jar file)

Posted: 03 Aug 2010, 12:11
by Lapo
Step 6 is not even necessary. If you set your extension as AUTO-RELOAD in the config tool the jar file will be monitored and reloaded at runtime.

There's still a few optimizations we want to add to this hot-redeploy system but it's already working good.

Posted: 20 Aug 2010, 20:22
by peter.dalton
Does anyone know how to debug the java server extensions? I found some help for SFS 1.6, however 2x doesn't seem to be the same.

Thanks,

- Peter

Posted: 21 Aug 2010, 14:51
by Lapo
Although I haven't tried you should proceed in the same way as for SFS1. The principle is the same. What problem do you have?

Posted: 30 Sep 2010, 23:51
by peter.dalton
I have found documentation on how to debug SFS1:
viewtopic.php?t=1872

However it makes references to a file: Server\conf\wrapper.conf that I can't find anywhere or any file that seems to contain the referenced parameters.

Where would I find this information for SFS 2

Thanks,

Posted: 02 Oct 2010, 16:20
by Lapo
Hi,
the current SFS2X beta is launched via a .bat (Wind) or .sh (Linux) file.
You should edit your launcher file and add the following JVM switches:
-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n


This will enable the remote debugging

Posted: 27 Oct 2010, 11:48
by jpardoe
I encountered a problem when editing the build.xml file. When compiling the extension, the build failed with an error saying "{project location}\dist not found."

I think the problem was caused because -post-compile is called before the JAR file has been created. Of course, if the file has already been created, the error never shows up. It only occurs when you do a clean and build.

I managed to resolve the problem by placing the code below in -post-jar instead.

Code: Select all

<copy todir="{SFS2X path}\SFS2X\extensions\{your extension}\">
   <fileset file="${dist.jar}"/>
</copy>

Where

Posted: 28 Oct 2010, 15:03
by tommy408
Where do these debug command lines go? On the next line, same line, inside the quotation?

-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n



sfs2x.bat file :

@java -cp "./;lib/*;lib/Jetty/*;extensions/__lib__/*" -Dfile.encoding=UTF-8 com.smartfoxserver.v2.Main $1 $2 $3

Posted: 28 Oct 2010, 15:20
by Lapo
Same line, no quotations.
Like this:

@java -Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend= -cp "./;lib/*;lib/Jetty/*;extensions/__lib__/*" -Dfile.encoding=UTF-8 com.smartfoxserver.v2.Main $1 $2 $3

Posted: 31 Oct 2010, 19:39
by rjgtav
Hi. which version of netbeans do i need to install?

Java SE, JavaFX, Java, Ruby, C/C++, PHP or All?

Posted: 01 Nov 2010, 09:21
by Lapo
Java SE is sufficient

Posted: 01 Nov 2010, 13:38
by rjgtav
thx.

NetBeans 6.9.1 and Windows 7

Posted: 02 Dec 2010, 07:57
by lolandroll
I found this http://www.smartfoxserver.com/docs/docP ... ions.htm#1 - is this equal to SFS2X and will help me set up and compile my First very Basic extension with my enviroment? Or maybe there is a step by step tutorial on how to do it that i can find on that forum?

many thanks

Posted: 02 Dec 2010, 08:07
by Lapo
Here:
http://docs2x.smartfoxserver.com/Advanc ... extensions
we explain the dependencies needed to compile an extension. It is just two files from the lib/ folder: sfs2x.jar and sfs2x-core.jar.

The tutorial you have found can help you to go through the various dialogues while configuring the IDE.

We'll soon publish a step by step tutorial for SFS2X too

my enviroment

Posted: 03 Dec 2010, 06:59
by lolandroll
Thanks for help - enyway i forgot to add that i'am using Win7 an NetBeans 6.9.1 IDE.

"We'll soon publish a step by step tutorial for SFS2X too" - I'll be waiting impatiently for this.

Cheers