Java - Creating first extension

Post here your questions about the Java client / Android API for SFS2X

Moderators: Lapo, Bax

Posts: 2
Joined: 03 Jul 2012, 19:37

Java - Creating first extension

Postby MJFoxman » 03 Jul 2012, 21:34

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(
User avatar
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: Java - Creating first extension

Postby rjgtav » 03 Jul 2012, 22:01

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).
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
SFS Tutorials: - Discontinued. Some examples may be bugged.
Posts: 2
Joined: 03 Jul 2012, 19:37

Re: Java - Creating first extension

Postby MJFoxman » 04 Jul 2012, 21:22

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.

Return to “SFS2X Java / Android API”

Who is online

Users browsing this forum: No registered users and 2 guests