Load External Java Library
Posted: 22 May 2016, 01:06
My AI deploys and runs without crashing. I want to utilize a library in an external JAR file (signalr-client-sdk.jar). I've placed the JAR file in the /jlib directory under my AI, alongside vecmath.jar and JavaOO-AIWrapper.jar etc. I add a line of code in my AI's init method instantiating an instance of a class from the JAR file.
My code compiles fine in Netbeans with this instantiation line. But it crashes my AI in Spring. I think it's not seeing my JAR file. How do I make it aware of it? Here's my infolog.txt snippet:
Note, I'm using the 101.0.1-373-g9d13eb6 development build as it fixed an issue with loading Java AI's.
My code compiles fine in Netbeans with this instantiation line. But it crashes my AI in Spring. I think it's not seeing my JAR file. How do I make it aware of it? Here's my infolog.txt snippet:
Code: Select all
[f=-000001] [Java Interface] JRE found in env var "JAVA_HOME"!
[f=-000001] [Java Interface] Using JRE (can be changed with JAVA_HOME): C:\Program Files (x86)\Java\jdk1.8.0_91\jre
[f=-000001] [Java Interface] Successfully loaded the JVM shared library at "C:\Program Files (x86)\Java\jdk1.8.0_91\jre\bin\client\jvm.dll".
[f=-000001] [Java Interface] Unable to find common read-only data-dir (optional).
[f=-000001] [Java Interface] Unable to find common read-only native libs data-dir (optional).
[f=-000001] [Java Interface] Initialization successfull.
[f=-000001] Warning: AI for team 0 (ID: 0) failed handling event with topic 1, error: -5
[f=-000001] Error: Failed to handle init event: AI for team 0, error -5
[f=-000001] [WatchDog] deregistering controls for thread [load]
[f=-000001] Loaded DecalsDrawer: Legacy
[f=-000001] GameID: 2ce64057eb992dc92109bfd6a4e560fe
[f=-000001] Connection attempt from msm8bball
[f=-000001] -> Version: 101.0.1-373-g9d13eb6 develop
[f=-000001] -> Connection established (given id 0)
[f=-000001] Player msm8bball finished loading and is now ingame
[f=-000001] Skirmish AI "Bot1" (ID:0), which controlled team 0 is now dead
[f=0000130] [QuitBox] user exited to system