Problem:
I have split my robot into many files. When using the Robocode packager not all java classes are packed into the jar file.
Only java classes directly called from the main class (the class that is being extended from AdvancedRobot) are being
packaged. Classes called from classes called from the main class are not being packaged.
I tried a workaround by defining an method in my main class (called deadcode) which calls all the missing classes.
This was only a partial succes. All the missing classes where added to the jar-file. Trying to run with this jar-file resulted
in the following exception:
java.lang.LinkageError: loader constraint violation: loader (instance of net/sf/robocode/host/security/RobotClassLoader) previously initiated loading for a different type with name "jaws/data/tracking/TrackingPoint"
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:803)
at java.lang.ClassLoader.defineClass(ClassLoader.java:884)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
at net.sf.robocode.host.security.RobotClassLoader.loadRobotClassLocaly(RobotClassLoader.java:139)
at net.sf.robocode.host.security.RobotClassLoader.loadClass(RobotClassLoader.java:98)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at jaws.data.EnemyRobotTracker.addTrackingPointFromScannedRobotEvent(EnemyRobotTracker.java:87)
Environment:
Robocode 1.9.2.5 version.
Running with Java 7 (in Ubuntu) from Eclipse Luna.
Anonymous
I should like to have a look of your robot and all the classes.
Could you zip the source files and send these to me: fnl (at) users.sourceforge.net
View and moderate all "support-requests Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Support Requests"
LS,
Sorry it took so long to respond. The mail I send got a time-out. Not sure why. I send you the requested information this way.
As you requested a zip file with my sources. I stripped te code down as much as possible.
Problem: When I package the robot the contents of the java (sub)package jaws/data/tracking/ (and subpackes) is not being packaged by the 'Robocode packager'.
The 'Robocode packager' results are:
jaws/utils/Calculator.class
jaws/data/EnemyRobotTracker.class
jaws/testBot.class
jaws/data/Location.class
jaws/data/FiringSolution.class
jaws/testBot.properties
jaws/events/ToCloseToWallEvent.class
---- Codesize ----
Codesize: 2009 bytes
Robot weight class: MegaBot (codesize >= 1500 bytes)
For instance the file jaws/data/tracking/LinearMotionTracker.class is missing. And this is used when I run the robot from inside Eclipse.
As a control I tested with a realy simple robot. No hested classes. Then every thing works fine.
Sorry for the late answer.
I have tried out your sources, but found no problem?
What I do to compile and package your robot is this:
1) Unzip your .zip fil and copy the jaws directory (with source files and sub directories) into [robocode dir]/robots
2) Start up Robocode and open your testBot.java
3) Compile testBot.java
4) Start a new battle with the jaws.testBot + some other robot. Note that testBot with have a star behind it, as it is considered a development version until it has been packaged.
5) Start up the Robot Packager and select the jaws.testBot
6) Start a new battle with the jaws.testBot (without a star), which will run the robot from the jar package.
This is what result from the Robot Packager:
---- Codesize ----
Codesize: 2498 bytes
Robot weight class: MegaBot (codesize >= 1500 bytes)
The file jaws/data/tracking/LinearMotionTracker.class is not mising in my jar file.
Perhaps there is a difference if you have set up a development path to an Eclipse project. In this case Robocode examines the .classpath (or .project) file from the Eclipse project to detirmine which files to include. There might be an issue here?
I believe the problem is related to the Eclipse project files that might have come out of sync somehow. Hence, moving the sources around might have triggered an update of the classpath in the Eclipse project files, that Robocode looks into.
But it could also be due to the robot.database, which is located in the [robocode dir]/robot folder, which could have come out of sync with the Eclipse classpath. If so, it might have helped if the database was refreshed or simply deleted (deleting robot.database), as Robocode will automatically rebuild this file. It works like a cache/index to Robocode.
Last edit: Flemming N. Larsen 2016-06-09
Hello,
Can you please help me find the java code for a robot using multiple aiming methods
like linear, circular, static and also capable of tracking every bullet for a hit or a miss and use this information to improve its capability to sharp shoot other enemy robots.
I look forward to get a positive response from you.