ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
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 have seen this posted before, so I know there is a solution somewhere. It seems as though I have a version conflict between Java versions (compiler vs. runtime) - here is the issue, I compile a version of my test app, very simple, it compiles just fine - console application (not applet, for the moment, I am not targeting applets), I try to run it and get "Unsupported major.minor version 52.0" - I would like to run under version 1.8 - how do I fix this definitively. Don't pull punches, I want to compile targeting version 1.8 and run under version 1.8. What do I do?
This simple code fails:
code start:
public class HelloWorld
{
public static void main(String[] args)
{
System.out.println( "Hello world!");
}
}
code end
compile dump returns no error. Try to run, I get:
java HelloWorld
Exception in thread "main" java.lang.UnsupportedClassVersionError: HelloWorld : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
ABRT problem creation: 'success'
What is the problem here and what are the step by step solutions for it?
Thanks
Well, then find a way(*) that the two versions be the same.
Or, alternatively try and compile with these options:
Code:
javac -source 1.4 -target 1.4 HelloWorld.java
(*) Via installing/updating packages, setting/changing environment variable PATH and JAVA_HOME, creating symlinks or whatnot. Ask your sysadmin for help.
Note: if you have JDK installed, it has a JRE in it, use that.
Thanks.
That worked for the simple code, but, the real code won't compile under 1.4, where do I get the *right* versions so the compiler and the runtime work together?
Thanks again.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.