jump to navigation

JDK Linux February 1, 2008

Posted by Nirmal in IT, technology.
trackback

 sun-java.jpg

sun.com/java

Atlast got the ubiquitous Java Development Kit on Edubuntu. It was bit of a trouble to start with. I was starting on Java but since playing with it on a Compaq at the prestigious 15th Floor Lab, I didn’t meet it on Linux. I’ve got NetBeans on Windows, but I rarely go there and I feel a bit outta place to get there just for a cuppa Java. Previously I tried to get NetBeans on *buntu but I got busted somehow. So yesterday I walked upto our Java expert Shash and ask what I do. Shash says of course, and recommends that I get the 60MB something download available at the Stanford University Network’s excellent download center. They have a cool amount of install instructions as well, and it goes without a hitch. Then comes trouble.

Got the Test listing from the language specification purely for test purposes and fire up the thing. Javac path hasn’t been set yet so I compile by referring to it via the complete path. But java seem to be already on the PATH. So I compile and try to run, and java dares to spit this out at me:

astdb@localhost:~$ /opt/jdk/jdk1.6.0_04/bin/javac -g Test.java
astdb@localhost:~$ java Test Hello, World!
Exception in thread “main” java.lang.ClassFormatError: Test (unrecognized class file version)
at java.lang.VMClassLoader.defineClass(libgcj.so.7)
at java.lang.ClassLoader.defineClass(libgcj.so.7)
at java.security.SecureClassLoader.defineClass(libgcj.so.7)
at java.net.URLClassLoader.findClass(libgcj.so.7)
at java.lang.ClassLoader.loadClass(libgcj.so.7)
at java.lang.ClassLoader.loadClass(libgcj.so.7)
at java.lang.Class.forName(libgcj.so.7)
at gnu.java.lang.MainThread.run(libgcj.so.7)
astdb@localhost:~$

What the?? i didn’t make the class file, you did. So if YOU can’t interpret it, who the heck can??

No amount of fooling around that night gives any help and I’m tired. JK consortium is about to kill me. So I meet with Shash yesterday, and tell him. He digs about the Internet, and comes up with the exact thing. What was the glitch? Simply the cool java command I’ve been conveniently using hasn’t been pointing to /opt/jdk/jdk1.6.0_04/bin/java, which I was intending to invoke, but to some muck. So come home, say PATH=”/opt/jdk/jdk1.6.0_04/bin:$PATH” and all is seem to be set. All quiet on Western Front. Let me brew a cup of Java.

Comments»

1. Vickie - February 19, 2008

Hi, i am running the Linux operating system Mandriva 2007 and would like to do java and c++ programming on it, please advice what tools i need as well as where to get them.