Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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(SecureClassLoader.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.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
marco@marco-laptop:~/Project/JFiles>
its a simple code and i dont think i made a mistake doing that.
I'm no expert in this field, but allot of people don't set up Java correctly, on this web page is a link called "java runtime Plugin". The site is for Fedora 6, but the java set up should apply to most, pay attention to "Note" regarding compatible libraries, and under that is a section called "Controlling Java through 'alternatives'" which might tip you in the right direction.
Not true, the code is perfectly sound. I really don't see any superfluous brackets; sure, there is one in the comment but by definition anything appearing in comments gets ignored by the compiler - so there isn't any problem at all, really.
That being said, it's my understanding that this issue is solved; I think Marco posted this bit of code only to show it is.
i found the solution, i was using two different java version.
i just replace the java and javac from the usr/lib/ and now i can compile and run my java code.
Thanks for your replies
That works now, but the next time you have an update of gcj, its going to wipe those files. I don't use suse, but there's a proper way to set up java along with gcj. It's up to you to find out.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.