javac: invalid flag: robots\eu\ase\jrobot*java
Usage: javac <options>
use -help for a list of possible options</options>
C:\Users\Alex\Desktop>java -Xmx512M -cp libs/robocode.jar -XX:+IgnoreUnrecognizedVMOptions "--add-opens=java.base/sun.net.www.protocol.jar=ALL-UNNAMED" "--add-opens=java.base/java.lang.reflect=ALL-UNNAMED" "--add-opens=java.desktop/javax.swing.text=ALL-UNNAMED" "--add-opens=java.desktop/sun.awt=ALL-UNNAMED" robocode.Robocode -battle battles\Assignment.battle
Error: Could not find or load main class robocode.Robocode
I think the issue is coming from the first error, any ideas on how to fix it? Thanks in advance!
Sent from Mail for Windows 10
You do not have to write all that stuff. Just use robocode.bat for specifying the battle like:
robocode -battle intro
All the ugly stuff has been put into the robocode.bat and robocode.sh so you don't have to be bothered with all the details for running robocode. :-)
Notice the last argument in robocode.bat: %*
The last part (%*) is used for specifying commands when using robocode.bat. ;-)
So you should be able to run your battle by standing in the robocode home folder and write:
robocode -battle Assignment
I hope this helps?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The first error is caused by a typo in your javac command—you’re missing a dot before java in the wildcard. It should be robots\eu\ase\jrobot*.java, not *java. Once the classes compile correctly, also ensure your classpath includes both robocode.jar and the current directory (-cp .;libs\robocode.jar), otherwise Java won’t find robocode.Robocode.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi, I have a problem with trying to create a batch file for my battles in Robocode.
This is the code I am using:
@rem set JAVA_HOME = C:\Program Files\AdoptOpenJDK\jdk-8.0.242.08-hotspot
@rem set PATH=.;%JAVA_HOME%\bin;%PATH%
javac -encoding UTF-8 -cp libs\robocode.jar;robots robots\eu\ase\jrobot*java
java -Xmx512M -cp libs/robocode.jar -XX:+IgnoreUnrecognizedVMOptions "--add-opens=java.base/sun.net.www.protocol.jar=ALL-UNNAMED" "--add-opens=java.base/java.lang.reflect=ALL-UNNAMED" "--add-opens=java.desktop/javax.swing.text=ALL-UNNAMED" "--add-opens=java.desktop/sun.awt=ALL-UNNAMED" robocode.Robocode %* -battle battles\Assignment.battle
@pause
But it gives me the following errors
javac: invalid flag: robots\eu\ase\jrobot*java
Usage: javac <options>
use -help for a list of possible options</options>
C:\Users\Alex\Desktop>java -Xmx512M -cp libs/robocode.jar -XX:+IgnoreUnrecognizedVMOptions "--add-opens=java.base/sun.net.www.protocol.jar=ALL-UNNAMED" "--add-opens=java.base/java.lang.reflect=ALL-UNNAMED" "--add-opens=java.desktop/javax.swing.text=ALL-UNNAMED" "--add-opens=java.desktop/sun.awt=ALL-UNNAMED" robocode.Robocode -battle battles\Assignment.battle
Error: Could not find or load main class robocode.Robocode
I think the issue is coming from the first error, any ideas on how to fix it? Thanks in advance!
Sent from Mail for Windows 10
Hi Ioan,
You do not have to write all that stuff. Just use robocode.bat for specifying the battle like:
All the ugly stuff has been put into the robocode.bat and robocode.sh so you don't have to be bothered with all the details for running robocode. :-)
Notice the last argument in robocode.bat:
%*The last part (
%*) is used for specifying commands when using robocode.bat. ;-)So you should be able to run your battle by standing in the robocode home folder and write:
I hope this helps?
The first error is caused by a typo in your javac command—you’re missing a dot before java in the wildcard. It should be robots\eu\ase\jrobot*.java, not *java. Once the classes compile correctly, also ensure your classpath includes both robocode.jar and the current directory (-cp .;libs\robocode.jar), otherwise Java won’t find robocode.Robocode.