Page 1 of 1

Java - Creating first extension

Posted: 03 Jul 2012, 21:34
by MJFoxman
I'm trying to run to follow the tutorial for creating your first extension and when I run the sfs2x.bat i get the error below.

17:23:51,589 INFO [main] managers.SFSZoneManager - Creating room: (default)
The Lobby
17:23:51,597 INFO [main] api.SFSApi - Room created: [ Room: The Lobby, Id:
0, Group: default, isGame: false ]
Exception in thread "main" java.lang.UnsupportedClassVersionError: my/test/MyExt
ension : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at Source)
at Source)
at$000(Unknown Source)
at$ Source)
at Method)
at Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.smartfoxserver.v2.entities.managers.SFSExtensionManager.createJavaExtension(
at com.smartfoxserver.v2.entities.managers.SFSExtensionManager.createExtension(
at com.smartfoxserver.v2.entities.managers.SFSZoneManager.createRoom(
at com.smartfoxserver.v2.entities.managers.SFSZoneManager.createZone(
at com.smartfoxserver.v2.entities.managers.SFSZoneManager.initializeZones(
at com.smartfoxserver.v2.SmartFoxServer.start(
at com.smartfoxserver.v2.Main.main(

Re: Java - Creating first extension

Posted: 03 Jul 2012, 22:01
by rjgtav
It looks like you've built your extension with the latest JDK 7, which is by default selected in most IDEs. Please change it back to JDK6 and build the extension again.
Another option is to update the jre that comes with SFS2X with the latest JRE 7 (you have to paste the jre7 files inside the [SFS2X Installation Path]\jre folder).

Re: Java - Creating first extension

Posted: 04 Jul 2012, 21:22
by MJFoxman
Yea that is what I thought the problem was, but when I tried it the first time I only changed the libs to JRE 6. Since you suggested the same thing I thought, gave it a second shot and remembered to change the compiler to 1.6 as well. Got it working now, thanks for the help.