help Running robocode TestWallBehavior

Skip to first unread message

Apr 27, 2020, 6:35:09 AM4/27/20
to robocode

I'm on MacOS 10.15.4 and using Java 13, robocode, robocode-test

Today I've downloaded the robocode.testing- and installed it correctly in the robocode folder and started following the instructions.
First I've noticed that only .bat files exists but opening them anyone can see that inside are very basic javac and java calls, easily replicable in the terminal but I wanted it available inside the eclipse environment.
I've recreated the java file for TestWallBehavior with copy and paste, adjusted the package and included Junit and robocode.testing jars in the build path.
So far so good, the java file compiles into .class file.
To run the test I've added the -Drobocode.home argument with the correct path from the root of the computer.
The problem come here, when I run the test it fails whit an exception: java.lang.NoClassDefFoundError: org/hamcrest/SelfDescribing
org.hamcrest is not in my build path anywhere, so I've downloaded it and included into the path, here I think there's a missing library in the release or the instructions needs to be updated
Next I run again but I find another error: java.lang.ClassNotFoundException: net.sf.robocode.core.RobocodeMainBase
this class is not present in my robocode.jar.

I stopped here...what am I doing wrong? what am I missing to be able to run this TestWallBehavior test?



Apr 27, 2020, 4:50:05 PM4/27/20
to robocode
Thank you for telling me about this issue.
The scripts for running the tests need to be updated as well as the documentation.

You are right. This jar file is missing: hamcrest-all-1.3.jar. (The plugin needs an update for sure)
You can download it from here: and put it into the robocode\libs folder.

Then you need to add this library to the class path when running the test script:

java -Drobocode.home=.. -cp ../libs/junit-4.11.jar;;../libs/hamcrest-all-1.3.jar;../libs/robocode.jar;../libs/robocode.testing.jar;.; org.junit.runner.JUnitCore sample.TestWallBehavior

This should be enough. I have just tested this with a clean installation of Robocode with the testing plugin.

I should like to hear if you can get it running on your system as well?

- Flemming

Apr 28, 2020, 5:16:10 PM4/28/20
to robocode
Thanks for the reply.

I've tried again and I was still missing an net.sf.robocode.core.RobocodeMainBase that I could not find in the robocode.jar library...but you can, so I focused on the differences: you are running it from terminal, I'm running it through Eclipse! 1 minute later I've figured out that I was working only with the robocode.jar library instead of importing all the jars in the robocode/lib folder. As soon as I've imported everything I've seen the "robocode.core-", the library that contains the net.sf.robocode.core.RobocodeMainBase class.
Now I can create and run tests in Eclipse and check the result inside it too.

I'm using successfully hamcrest-2.2.jar with now and I can't see any different problem that hamcrest-1.3, I've downloaded both so I can switch in case.

closed this, I would like to point out the red warning in the output during the run:

WARNING: An illegal reflective access operation has occurred

WARNING: Illegal reflective access by (file:/Users/dtp4/robocode/libs/robocode.core- to field

WARNING: Please consider reporting this to the maintainers of

WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations

WARNING: All illegal access operations will be denied in a future release

this comes out every run, despite the run finishes correctly. I bet you already know about this, if not here it is. This is maybe matter for the other group of discussion.

Best regards
Reply all
Reply to author
0 new messages