Java - Creating first extension

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

Moderators: Lapo, Bax

MJFoxman
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 java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.smartfoxserver.v2.entities.managers.SFSExtensionManager.createJavaExtension(SFSExtensionManager.java:334)
at com.smartfoxserver.v2.entities.managers.SFSExtensionManager.createExtension(SFSExtensionManager.java:259)
at com.smartfoxserver.v2.entities.managers.SFSZoneManager.createRoom(SFSZoneManager.java:701)
at com.smartfoxserver.v2.entities.managers.SFSZoneManager.createZone(SFSZoneManager.java:414)
at com.smartfoxserver.v2.entities.managers.SFSZoneManager.initializeZones(SFSZoneManager.java:240)
at com.smartfoxserver.v2.SmartFoxServer.start(SmartFoxServer.java:227)
at com.smartfoxserver.v2.Main.main(Main.java:31)
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: Java - Creating first extension

Postby rjgtav » 03 Jul 2012, 22:01

Hello.
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#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
MJFoxman
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 22 guests