Cant load my Java extention.

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

Moderators: Lapo, Bax

Post Reply
Baiumka
Posts: 9
Joined: 04 Dec 2018, 09:57

Cant load my Java extention.

Post by Baiumka »

Hello. Before i tried make JavaScript extention and all was right. I loaded it with out any problems. Now i begin studing Java and meet with one problem.

I wrote code, made .JAR files and move they to "extention/My" folder, but cant find them in list of avaible extentions. Can anyone say me a reason? =)

I think i did something wrong with packages in IDE.

P.S. Sorry for my bad English
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Cant load my Java extention.

Post by Lapo »

Hello,
make sure your jar file is named <Something>Extension.jar.
For example MyGameExtension.jar, or MyExtension.jar or WhateverExtension.jar.

Also add "Extension" at the end of the main class that extends SFSExtension.

Cheers.
Lapo
--
gotoAndPlay()
...addicted to flash games
Baiumka
Posts: 9
Joined: 04 Dec 2018, 09:57

Re: Cant load my Java extention.

Post by Baiumka »

Lol, first i think its joke, but it really work. Thank you)
vokial_voc
Posts: 45
Joined: 24 Oct 2013, 14:17

Re: Cant load my Java extention.

Post by vokial_voc »

hi, sorry to revive this post again, i just re-learn smartfox again

i'm having this problem but i already rename my jar to DGFServerExtension.jar , but i can't see anything in zone extension, is there anything i need to do? i use ecclipse Version: 2022-09 , with jdk 1.8 and windows smartfoxserve verson 2.19.

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

Re: Cant load my Java extention.

Post by Lapo »

Hi,
when configuring the Zone in the AdminTool make sure the "Use naming convention" switch is turned off.
When it's on it will only show classes whose name end with "Extension"

That should be all. If it still doesn't work, make sure that the generated jar file really contain the classes you want to export.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
vokial_voc
Posts: 45
Joined: 24 Oct 2013, 14:17

Re: Cant load my Java extention.

Post by vokial_voc »

still not working, i have export all generated class in jar but nothing seems work, did jre version problem? what ide should i use for java server development, is eclipse good? how about jre? which version should i use? the default from eclipse is java 19
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Cant load my Java extention.

Post by Lapo »

Eclipse is perfectly fine and you can use any JDK you want.
Just make sure to set the compiler compliance level to Java 8. Under Eclipse check the properties of your project and under Java Compiler set the compliance to Java 1.8

If you're using SFS2X 2.18 or higher you can set the compliance up to Java 11.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
vokial_voc
Posts: 45
Joined: 24 Oct 2013, 14:17

Re: Cant load my Java extention.

Post by vokial_voc »

still haven't get it, is this setting correct ?
Image

Image

Image

Image

Image

or something should be changed?
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Cant load my Java extention.

Post by Lapo »

The jar file should be inside your Extension folder, not outside.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
vokial_voc
Posts: 45
Joined: 24 Oct 2013, 14:17

Re: Cant load my Java extention.

Post by vokial_voc »

i have move the jar file inside folder but nothing showing, is there anyhing else from the setting?
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Cant load my Java extention.

Post by Lapo »

Can you send us the jar file to our support@... emailbox with a reference to this post?
We'll take a look.

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games
vokial_voc
Posts: 45
Joined: 24 Oct 2013, 14:17

Re: Cant load my Java extention.

Post by vokial_voc »

i think i mess up the export, i tried to unzip the jar and turn out nothing in it.. any information how to export correctly? how to add my class inside the jar?
vokial_voc
Posts: 45
Joined: 24 Oct 2013, 14:17

Re: Cant load my Java extention.

Post by vokial_voc »

never mind, already know the issue, now enter another issue, here is the log, is it jdk issue?

Exception: com.smartfoxserver.v2.exceptions.SFSException
Message: Extension creation failure: DGFServerExtension - Unexpected error while launching Extension: com.sushi.DGF.ServerExtension -- com/sushi/DGF/ServerExtension has been compiled by a more recent version of the Java Runtime (class file version 62.0), this version of the Java Runtime only recognizes class file versions up to 55.0
Description: There were startup errors during the Zone Setup
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Cant load my Java extention.

Post by Lapo »

Hi,
yes as mentioned earlier, Extensions must be compiled for Java 8 or 11, depending on what SFS2X version you're using.

SFS2X 2.18.0 and higher supports Java 11, all prior versions require Java 8
Just make sure to set the Compiler compatibility level to the right value in your Eclipse project's settings.

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
vokial_voc
Posts: 45
Joined: 24 Oct 2013, 14:17

Re: Cant load my Java extention.

Post by vokial_voc »

i see, all set and done, thanks Lapo for the support
Post Reply