Results 1 to 5 of 5
Hello, i try to compile and make run my java files from terminal
I have installed the Sun jre 1.5 package that commes with the installation package of Linux and ...
- 03-23-2007 #1Just Joined!
- Join Date
- Nov 2006
- Location
- Luxembourg
- Posts
- 42
Compiling and launching java from the terminal
Hello, i try to compile and make run my java files from terminal
I have installed the Sun jre 1.5 package that commes with the installation package of Linux and i have installed the new version the 1.6 from Sun too. Then i have the 2 version in my laptop (1.5 in /usr.... and the other one in /opt/....).
Previously i have set the path of the javac like that: export PATH=$PATH:/path/to/java/bin
Then, after compiling the file i try to launch the file and a message error is sent:
marco@marco-laptop:~/Project/JFiles> javac Cejemplo01.java
marco@marco-laptop:~/Project/JFiles> java Cejemplo01
Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java :620)
at java.security.SecureClassLoader.defineClass(Secure ClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader .java:260)
at java.net.URLClassLoader.access$100(URLClassLoader. java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java: 195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.j ava:18
at java.lang.ClassLoader.loadClass(ClassLoader.java:3 06)
at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:26
at java.lang.ClassLoader.loadClass(ClassLoader.java:2 51)
at java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:319)
marco@marco-laptop:~/Project/JFiles>
its a simple code and i dont think i made a mistake doing that.
Thanks in advance
- 03-23-2007 #2
Can you post your Java code?
Registered Linux user #270181
TechieMoe's Tech Rants
- 03-23-2007 #3Just Joined!
- Join Date
- Nov 2006
- Location
- Luxembourg
- Posts
- 42
class Cejemplo01{
public static void main(java.lang.String[] args){
System.out.println("Mi primera aplicacion en Java");
}
}
- 03-23-2007 #4Just Joined!
- Join Date
- Nov 2006
- Location
- Luxembourg
- Posts
- 42
or
class Cejemplo01{
public static void main(String[] args){
System.out.println("Mi primera aplicacion en Java");
}
}
- 03-23-2007 #5
When you set your path for javac, did you also change the path for java? It could be you're compiling with the Sun compiler and trying to run with a different version of the Java VM.
Registered Linux user #270181
TechieMoe's Tech Rants


Reply With Quote