[Home]Java

Robo Home | Changes | Preferences | AllPages

The programming language in which most Robocode robots are written.


Ok, this is a stupid question, and is just showing how little i actually know about java, but nevertheless: There are quiet a few things that require you to extract a .jar file. It seems you do that with the "jar -xf" command, however, i don't seem to have a jar.exe program. Is there something wrong with my java installation, and should i download it again, or what? -- Tango

you should call the*.jar files via java -jar parameters To create a JAR file jar cf jar-file input-file(s) To view the contents of a JAR file jar tf jar-file To extract the contents of a JAR file jar xf jar-file To extract specific files from a JAR file jar xf jar-file archived-file(s) To run an application packaged as a JAR file (version 1.1) jre -cp app.jar MainClass?

To run an application packaged as a JAR file (version 1.2 -- requires Main-Class manifest header) java -jar app.jar SSO?

I use winzip. -- Vuen

It does the same thing? OK, that makes life much simpler. Doesn't explain why jar isn't there, but nevermind. Thanks! -- Tango

I use "unzip" out of old habit. "unzip -l" lists the contents of a jar/zip file (like "jar -tf"). -- PEZ

jar.exe is in your <PATH_TO_JAVA_HOME>\bin directory. On my local system this is "C:\j2sdk1.4.1_04\bin>". By default the Java installer does not seem to add this directory to your %PATH% so you need to add it yourself or explicity call jar with the full path name. -- jim

Also, note that you will need Java Development Kit. If you have only the Java Virtual Machine installed, then you probably don't have the jar.exe -- Albert

It's not in /bin, that's one of the first places i looked. Prehaps i don't have the JDK, i should probably get it... -- Tango


I found this benchmark (https://osnews.com/printer.php?news_id=5602) today. Look at the trigonomettry results with the Jdk 1.4.2 :( In the analyses these are almost completely ignored. Maybe this shouldn't hurd too bad as it's not the heavy usage of trig but mostly the (double) math in pattern matchers that makes a bot slow. --Loki

Trig functions usually aren't called all that often compared to simple math, and since 1.4.2 rivaled C++ in double/int/long speeds I'd say there isn't much to worry about. It's actually the loops of thousands of comparisons, searchs, etc that make most bots slow. Most bots nowadays don't seem to be slow enough to really hurt, anyway, so I'm not sure it matters. Of course implementing better algorithms for sorting and searching could probably speed up some megabots and matchers.

If you really want to get rid of the trig calls I'd suggest a lookup table. Make an array of 360 elements, fill each one with it's sin at startup, the just use sin[<degree value>] to get a sin. Personally I wouldn't bother, but lookup tables used to be a very popular means of getting rid of this type of call so I thought I'd mention them. -- Kuuran


Are there any known drawbacks on using jre 1.5 instead of 1.4.2? Now there are at least 3 bots I can't handle with RR@H because they expect 1.5 compatibility (ph.mini.Archer, pulsar.nanis and throxbot.Throxbot) -- GrubbmGait

That seems like a question and an answer pairing. =) Seriuosly, I suggest we remove any must-use-1.5 bots from the rumble. -- PEZ

If necessary, I am willing to update the client to jre 1.5 (or 5.0 as Sun calls it). I do not know the benefits and drawbacks of such an update. Or maybe Pulsar, Ph and the author of Throxbot could release an 1.4.2-compatible version. -- GrubbmGait

There are no drawbacks with that as I can see. I thought you were referring to drawbacks using 1.5 features in a bot. Using 1.5 for the client is as easy as setting JAVA_HOME to point to it and call java using that path. -- PEZ

On windows it's just a matter of installing Java 1.5 (or J2SE 5.0 as it's called) and it will be the new default java in the system. It's a very nice upgrade even if not using any 1.5 features, performance being one of them. 1.6 is nice too I might add ;-) Hmm I didn't know Nanis required 1.5 I didn't design it that way intentionally. But I used 1.5 mode in my IDE I guess. It can be released in a 1.4 compatible verison with a simple recompile I think (strange that even that was needed, so I migt be wrong). But for the record I might switch to 1.5 in a future version for a bot or two. -- Pulsar

I am able to run the current version on Nanis, maybe version 0.2 had some 1.5 feature in it. Probably I will convert (at least with my RR@H machine) to Java 1.5 this weekend. -- GrubbmGait


Nice benchmarks graph - been having a lot of "java is 5 times slower than C++" "no it isn't" "yes it is" "...zzzzzz..." type arguments with friends recently and that graph can be lobbed gently through the window like a multicoloured handgrenade :) I believe the trig in 1.4.2 was particularly slow because a bug was introduced at that point and it should be a lot quicker in 1.5. Anyone know this for sure? I ended up using trig lookup tables in Vapour btw in my efforts to optimise and didn't really notice any significant difference, just to confirm what was stated above :) -- Shrubbery


Is it yet generally allowable to use Java 1.5 features in bots? -- Kuuran

Quite a few RR@H clients are still running Java 1.4, as is about 1/4 of the RLL. So I'd say, in general, no. I've always thought it would be fun to make FloodMini 1.5 in Java 1.5, though. You'd think, though, that this group would be the early-adopter group when it comes to Java versions ;-) -- Kawigi


Robo Home | Changes | Preferences | AllPages
Edit text of this page | View other revisions
Last edited May 18, 2006 20:05 EST by GrubbmGait (diff)
Search: