AI Class not found

AI Class not found

Discuss your problems with the latest release of the engine here. Problems with games, maps or other utilities belong in their respective forums.

Moderator: Moderators

Post Reply
Eadword
Posts: 21
Joined: 15 Aug 2012, 06:34

AI Class not found

Post by Eadword »

I was working on my own java AI (based on NullOOJavaAI) and its main class is com.springrts.ai.simpleai.SimpleAI

As I load my AI in spring, this error appears in interface-log.txt:
Fri Aug 17 13:24:32 2012 / ERROR(1): Class not found "com.springrts.ai.simpleai.SimpleAI"
Fri Aug 17 13:24:32 2012 / ERROR(1): Class loading failed for class: com.springrts.ai.simpleai.SimpleAI
I have triple-checked the FQDN and it matches the one provided in AIInfo.lua

Here are my configs/logs:

http://pastebin.com/BkfFbR1X AIInfo.lua
http://pastebin.com/Rd2YN7kc interface-log.txt
http://pastebin.com/5da8vQWQ infolog.txt

File structure of my AI's jar:

com/springrts/ai/simpleai/SimpleAI.class
com/springrts/ai/simpleai/SimpleAI$1.class
com/springrts/ai/simpleai/SimpleAI$MyCustomLogFormatter.class
META-INF/MANIFEST.MF

Any ideas on the solution?

Tell me if I must post my AIs sources as well.
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: AI Class not found

Post by hoijui »

is there a SkirmishAI.jar with your classes in the smae dir as the AIInfo.lua of your AI?
did you use special arguments/options with CMake? (like -DLIBDIR or the like)

i now see that i put too few log messages...
if i read the code right, it would not even show a message if the AIs jar was not found, except the one you get there.
i should put messages like "using /a/b/c/SkirmishAI.jar"
if you want, you could do that yourself, recompile and test. all the relevant code is in:
AI/Interfaces/Java/src/main/native/JavaBridge.c
AI/Interfaces/Java/src/main/native/InterfaceDefines.h
i still hope to fix Java AI stuff with a few major changes (more Java side handling of stuff, as oposed to native, with some more flexibility and "industry standards")
Eadword
Posts: 21
Joined: 15 Aug 2012, 06:34

Re: AI Class not found

Post by Eadword »

yes, the SkirmishAI.jar file is located in the same dir as AIInfo.lua. Those files are located in %SPRING_DIR%/AI/Skirmish/SimpleAI/0.1/

I did do a little special compiling work, but nothing too special.
I specified only CMAKE_BUILD_TYPE=RELEASE

I did, however, come across an issue with the python unitsync library not compiling, so I had to compile it manually before I could install

I will pursue those log messages tomorrow morning, if you want, I can give you my patch. :)
Eadword
Posts: 21
Joined: 15 Aug 2012, 06:34

Re: AI Class not found

Post by Eadword »

Well, with 1 line of logging code added, I think I have caused the game to crash :)

However, I believe I have found the problem :D My AI was being compiled with java 7 while the spring library was being compiled with java 6. I did not realize that the compatibility was that bad.

That is also most likely why the java interface on my other computer did not load, because the .jar file for it was compiled with a different version than the JNI.

So... from what I can tell, the problem appears to be solved! Thank you much for your help, hoijui! :D
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: AI Class not found

Post by hoijui »

ahh perfect! :-)
good find.
and.. shame.. it would be nice to get an error message for that.. or if i could at least check it somehow, and generate the message myself..
or maybe just add this to the error log message we already have:
"... this could be caused by the SkirmishAI.jar missing, corrupted, not containing the required class, or the class beeing compiled with an other version of Java"
Post Reply

Return to “Help & Bugs”