Just 2-4 hours ago, i received an update to java on my laptop.
and i installed it.
I am working on an java application for a month now. I upload this application on heroku server.
Before java update, (2-3 days ago) everything worked fine.
But now when i upload the app and run it on heroku, it get this error :-
Exception in thread "main" java.lang.UnsupportedClassVersionError: MainClass has been compiled by a more recent version of the Java Runtime (class file version 58.0), this version of the Java Runtime only recognizes class file versions up to 52.0
2021-01-23T21:29:31.889016+00:00 app[worker.1]: at java.lang.ClassLoader.defineClass1(Native Method)
2021-01-23T21:29:31.889087+00:00 app[worker.1]: at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
2021-01-23T21:29:31.889208+00:00 app[worker.1]: at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
2021-01-23T21:29:31.889278+00:00 app[worker.1]: at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
2021-01-23T21:29:31.889361+00:00 app[worker.1]: at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
2021-01-23T21:29:31.889464+00:00 app[worker.1]: at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
2021-01-23T21:29:31.889589+00:00 app[worker.1]: at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
2021-01-23T21:29:31.889665+00:00 app[worker.1]: at java.security.AccessController.doPrivileged(Native Method)
2021-01-23T21:29:31.889746+00:00 app[worker.1]: at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
2021-01-23T21:29:31.889852+00:00 app[worker.1]: at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
2021-01-23T21:29:31.889922+00:00 app[worker.1]: at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
2021-01-23T21:29:31.890074+00:00 app[worker.1]: at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
2021-01-23T21:29:31.890142+00:00 app[worker.1]: at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:601)
I am using IntelliJ Idea.
Everytime, I choose default setting and by default, Idea picks up all the latest files that i have.
I think the issue is because i now need to compile the code using a lower version of Java?
Can someone tell me how to fix this problem ?
question from:
https://stackoverflow.com/questions/65864771/unsupportedclassversion-error-after-java-update 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…