Talk:Robocode/Add a Robot Project

From Robowiki
Jump to navigation Jump to search

Hi all. I have some problems with it. I create an eclipse project, then copy to this project sample folder from robocode/robots (as example). Then in robocode I open options->preferences->Development options and add path to the bin folder of my project (it has the same sample folder with compiled by eclipse class files). Is this correct? The problem is that the New submenu in robocode main window remains empty after that, I don't see my classes. If there is no any custom classpath in the Development options, robocode again can see default packages without problems. What could it be? Operating system: Mandriva Linux --Eredory 18:24, 7 August 2009 (UTC)

Hm, this sounds quite odd. Perhaps set the eclipse project up so the source and the bin directories are the same? (In the new project wizard, "Use project folter as root for sources and class files" instead of "Create seperate folders for sources and class files") I've always found it works more smoothly that way. --Rednaxela 01:59, 8 August 2009 (UTC)

I use same directory for binaries as well, and also I prefer the running from Eclipse method, I think is much better. The problem is that it uses a new robot directory, so at the beginning is empty or with your robot only, but you can copy the samples or any other bots into it. What I do is remove source folder src, create a source folder called robots, exclude from robots build path ".robotcache/" (without the quotes), and the rest is set up as the page posted above. --zyx 04:39, 8 August 2009 (UTC)

Hey guys. I would like to use an external library (Google Guava) for my robot, and it seems fine in Eclipse, but when I add the class directory of Google Guava to the Development tab I get tons of errors, mostly in the form of Preventing unknown thread Robocode main thread from access: (java.lang.RuntimePermission getClassLoader). Do you perhaps have any tips for me on how to proceed? --Daan 14:51, 12 June 2011 (UTC)

Funny, I've been thinking about that same library myself recently. I guess Robocode runs the entire workspace through the security checks that Robocode uses? (Like preventing classloaders, apparently, and doing raw file I/O.) Or are you actually using classloaders? I have Eclipse's output directory set to Robocode/robots and no setting in Robocode itself, but that's probably a silly setup (and will delete your entire robots dir if you're not careful). If you want other people to run your Guava-using robot, though, you'll need to have the Guava classes you use present in your robot JAR. The Apache License appears to allow this. Maybe try just copying the packages/classes you need into your development space? Good luck, let us know what you come up with. --Voidious 16:09, 12 June 2011 (UTC)

Thanks for your response Voidious! It seems indeed to have something to do with Robocode's security manager; it has a problem with some of the classes inside guava (classes which I'm not using). After some testing I found out that if you add guava's jar to the JVM classpath it works though. :) In regard to the final robot jar; I guess I could include the contents of guava into it and perhaps use ProGuard to remove all unused classes (which would include the offending classes). --Daan 18:02, 12 June 2011 (UTC)


Thread titleRepliesLast modified
Wrong name message when trying to add an Eclipse workspace/project to Robocode110:31, 19 March 2012

Wrong name message when trying to add an Eclipse workspace/project to Robocode

Hello, all. I'm brand new to Robocode (and using wiki discussions to ask questions), so please forgive me if this question has been answered before and if I'm going about asking it the wrong way.

I'm trying to integrate the Eclipse IDE for Java Developers, version Helios Service Release 2, using JDK1.6.0_24, with Robocode version, in Windows 7.

I followed the instructions in the wiki for adding an Eclipse robot project, but no matter what I've tried I get the following error message (or one like it, depending on how I configured my project and how I reference it in Robocode):

Got an error with MyFirstRobot.bmu.MyFirstRobot: java.lang.ClassNotFoundException: MyFirstRobot/bmu/MyFirstRobot (wrong name: bmu/MyFirstRobot)

My project name is MyFirstRobot, my package name is bmu, and my robot class name is MyFirstRobot. I've tried both of the "Use project folder as root for sources and class files" and "Create seperate folders for sources and class files" settings when creating the project. In the Robocode/Options/Preferences/Development Options tab, I've tried adding my workspace folder and/or child folders to the .class containing folder, all to no avail.

This problem also occurs when I try to run my project from Eclipse as described in another related wiki page.

Any ideas? (And thanks in advance!)

Burbanski16:07, 18 March 2012

Problem solved. There may have been more then one thing wrong, but I think at this point, it had mostly to do with which folder(s) I was adding in the Robocode/Options/Preferences/Development Options tab. I believe that initially I misread the label on the tab, and I added just my Eclipse workspace root, thinking it would look for all robots in all projects in the workspace. When that didn't work, I added the project folder that actually contained my robot .class file (e.g. when using "Use project folder as root for sources and class files", then C:\workspace\project\package\class, or when using "Create separate folders for sources and class files", then C:\workspace\project\bin\package\class). I figured out that you must add the project folder that contains the package (which might not always be the project root folder as suggested in the label; e.g. when using "Use project folder as root for sources and class files", then C:\workspace\project, or when using "Create seperate folders for sources and class files", then C:\workspace\project\bin).

Burbanski10:31, 19 March 2012