Talk:Robocode/My First Robot

From Robowiki
Jump to navigation Jump to search

HELP!

I am an experienced 13 year old Java programmer, and I decided to try this, (it looks VERY cool) but when I try to compile the simple default program it gives many errors. I figured out pretty quickly; it can't find the robocode package. I need to like set the classpath, but I can't directly do this. >=( Robocode SHOULD do this on its own...

Ok, I figured it out on my own... It's different on a mac. Awesomeness 01:01, 13 March 2009 (UTC)

Robocode can't simply do everything for you, becasuse it is a Java setting issue, if you are using Eclipse you can set it trough the Build Path Settings, on the Libraries tab, select Add External Jars, search for your Robocode instalation directory (default in Windows is C:\robocode) under that directory there should be a libs directory, there are four jars, you might not need all of them, but I recommend you add all of them for now.

If you are compiling from the console you should do something like

javac -cp C:\robocode\libs\cachecleaner.jar;C:\robocode\libs\codesize.jar;C:\robocode\libs\robocode.jar;C:\robocode\libs\roborumble.jar ...

To set the classpath, but I really recommend using an advanced IDE like Eclipse (or whatever you prefer, ie. NetBeans). Hope it helps, and welcome to Robocode. --zyx 08:55, 11 March 2009 (UTC)

Actually Zyx, you don't need the cachecleaner, codesize or roborumble jars ofr compiling bots. --Rednaxela 12:44, 11 March 2009 (UTC)

Maybe this is easier?

javac -cp C:\robocode\libs\*; ...

it load every library in /libs automatically. (ripped from Robocode 1.7 startup files) » Nat | Talk » 13:14, 11 March 2009 (UTC)

Yes Rednaxela, you are right that for compilation there is no point to include any jar that is not robocode.jar. I didn't know that the * wildcard worked but is good to know Nat. But all my disinformation comes from Eclipse, I added the 4 jars there and he knows what to use :-). --zyx 19:44, 11 March 2009 (UTC)

I don't think the * will work for .jar files. It works for .class files only. Well, that was my experience several years ago, when I last used Windows. --Skilgannon 19:49, 11 March 2009 (UTC)

  • I had to test it, it works as Nat posted it, but if it is missing that ; after the * it tries to use the jar files as input files and of course fails. But bottom line is that it does work. --zyx 00:29, 12 March 2009 (UTC)
  • It should work because robocode 1.7 later than 1.7.0.1 use this method. I myself just add robocode.jar to eclipse :-) » Nat | Talk » 00:51, 12 March 2009 (UTC)

Compiling

I can create my robot without a problem but when I go to compile it, it doesn't do anything and won't let me save it. Thoughts? I can set up battles (can't save them either...) and don't have the javac file which I think may be what's causing this. If it is, where is a good place to download it? I'm using Windows XP and I don't know if it's a 32-bit or 64-bit.--Giants27 21:52, 24 May 2010 (UTC)

I think you want to get the JDK for Windows here: [1]. If you don't know, I'd go with 32-bit. I thought Robocode would setup the "jikes" compiler if you didn't have javac installed, but I'm not sure. Once you have the JDK installed, (I'd probably restart Robocode, then) go to Robot Editor, Compiler > Options > Reset Compiler and it should find javac. Btw, are you getting an error when you try to compile, or what happens? You might also find some good info at Robocode/System Requirements or in Category:Tutorials. Good luck! --Voidious 21:59, 24 May 2010 (UTC)

When I go to compile, nothing happens and it just sits on the robot editing screen. It did install "jikes" but for whatever reason it still does nothing when I go to compile. I'll go try to install that.--Giants27 22:07, 24 May 2010 (UTC)

I installed JDK from here but, the robot editor still doesn't detect javac and I still can't save anything.--Giants27 22:20, 24 May 2010 (UTC)

Not that this has any relevancy to the discussion but why don't we include Javac instead of Jikes with robocode. I believe javac is open-sourced here: [2]. --Exauge

Interesting that Fnl just tweeted about a new default Java compiler today: [3]. --Voidious 00:16, 26 May 2010 (UTC)

Anything?--Giants27 22:17, 25 May 2010 (UTC)

I'm still a bit baffled about the actual problem, but you don't need to use the Robocode Editor to compile a robot. Many of us use Eclipse. You can start reading about that here if you want to try: Robocode/Eclipse. --Voidious 00:16, 26 May 2010 (UTC)
There are no threads on this page yet.
First page
First page
Next page
Next page
Last page
Last page
First page
First page
Next page
Next page
Last page
Last page