Menu

Problem with running battle via .bat from Eclipse

Help
Ben
2016-01-24
2016-01-25
  • Ben

    Ben - 2016-01-24

    Hi,
    Im having a bizzare problem when I try and run a battle from Eclipse, I originally tried running it using the Robocode Engine - a direct copy of the tutorial - but that always gave the error

    Can't find robocode.core-1.x.jar module near to robocode.jar
    

    so I abandoned that. Instead I am now using a .bat file that reads

    cd C:\Users\ben\Dropbox\RoboCode
    java -DNOSECURITY=true -Xmx512M -Dsun.io.useCanonCaches=false -cp libs/robocode.jar robocode.Robocode -battle battles\x3.battle -results saves\results.txt
    

    Which runs perfectly when I just run it by clicking it. But, when I try and call it from inside my java code it no longer accepts any robots that I've written in Eclipse and in the console says:

    Got an error with robotEC.GA: java.lang.ClassNotFoundException: robotEC/GA : Unsupported major.minor version 5
    2.0
    Got an error with robotEC.GeneticToolbox: java.lang.ClassNotFoundException: robotEC/GeneticToolbox : Unsupport
    ed major.minor version 52.0
    Got an error with robotEC.Genome: java.lang.ClassNotFoundException: robotEC/Genome : Unsupported major.minor v
    ersion 52.0
    Got an error with robotEC.Ribot: java.lang.ClassNotFoundException: robotEC/Ribot : Unsupported major.minor ver
    sion 52.0
    Got an error with robots.AdvancedEnemyBot: java.lang.ClassNotFoundException: robots/AdvancedEnemyBot : Unsuppo
    rted major.minor version 52.0
    Got an error with robots.EnemyBot: java.lang.ClassNotFoundException: robots/EnemyBot : Unsupported major.minor
     version 52.0
    Can't load 'robotEC.Ribot*' because it is an invalid robot or team.
    

    I have no idea whats happening. Any help would be appreciated,
    thanks.

     
  • Flemming N. Larsen

    The robots you try to run with Robocode has been compiled using Java 8 (which version 52.0 refers to - read more about it here).
    But you are running Robocode on an older Java version, e.g. version 7 or perhaps version 6. You can open the About Box in Robocode to check what Java version Robocode is running on.

    In order to fix this problem, you need to run Robocode using Java 8, or recompile the robots (if you have the sources) to an older Java version.

    You should be able to fix the problem by simply installing JRE 8 (Java Runtime Environment) or the JDK 8 (Java Developer Kit) on your system. Then Robocode should use Java 8 an run the robots without any trouble. :-)

     
  • Flemming N. Larsen

    Oh.... when running a .bat file from within Eclipse, you need to specify which Java version that applies when running the batch file. Alternatively setup the project or whole workspace to use Java 8. :-)

     
  • Ben

    Ben - 2016-01-25

    Hi,
    Thanks for the reply, that was definitely the problem.

    I do in fact already have the Java 8 JDK installed, with the workspace set to Java 8, And when Robocode is run independently it would run with Java 8. But for some reason when the .bat was run from Eclipse it would run Robocode with Java 7 ?!

    Anyway, thanks for the help!
    Much appreciated :)

     

Log in to post a comment.

MongoDB Logo MongoDB