Need to update to Java Runtime 62.0 -- not sure how to do it

Straitsfan

New Member
Joined
Dec 13, 2021
Messages
2
Reaction score
0
Credits
55
Hello. I've dabbled with Linux in the past, but my MB pro is dying -- started yesterday, in fact -- and it's time to switch. I have experience with the command line in the Terminal app, so most of the commands -- at least the basic ones -- I'm familiar with in Linux.

I 'm running elementary OS, and was able to download and install the Open JDK for Java 17. I'm working on a project as a way of learning Java. I have a folder labeled "Contacts Java Classes", and I know how to get to the folder, etc. There's a file that I want to run which contains the main method to get things going -- "MainWIndow.java" I can compile the file. Before when I tried to run the file w/o compiling I got this error:

Error: LinkageError occurred while loading main class MainWindow
java.lang.UnsupportedClassVersionError: MainWindow has been compiled by a more recent version of the Java Runtime (class file version 62.0), this version of the Java Runtime only recognizes class file versions up to 61.0

I was able to compile the file, and then I got this error when I entered "java MainWindow":

Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-17-openjdk-amd64/lib/libawt_xawt.so
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2393)
at java.base/java.lang.Runtime.load0(Runtime.java:755)
at java.base/java.lang.System.load(System.java:1953)
at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:388)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:232)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:174)
at java.base/jdk.internal.loader.NativeLibraries.findFromPaths(NativeLibraries.java:315)
at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:285)
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2398)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:818)
at java.base/java.lang.System.loadLibrary(System.java:1989)
at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:1392)
at java.desktop/java.awt.Toolkit$2.run(Toolkit.java:1390)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
at java.desktop/java.awt.Toolkit.loadLibraries(Toolkit.java:1389)
at java.desktop/java.awt.Toolkit.initStatic(Toolkit.java:1427)
at java.desktop/java.awt.Toolkit.<clinit>(Toolkit.java:1401)
at java.desktop/java.awt.Component.<clinit>(Component.java:624)
at MainWindow.<init>(MainWindow.java:10)
at MainWindow.main(MainWindow.java:52)

Everything works fine on my MB Pro. But even thought I've dabbled before in Linux -- and I just mean dabble, since I always had my OS X -- I'm not sure what's going on.

Should I upgrade to Java 18? And if so, what's the best way to do it? Can anyone help me out? I'v been on other forums, but I'm not sure what I need to sak, and I think I may have gotten under some people's skin. The installing on OS X is easy, but it's more complicated here in Linux, and I'm not sure where to go.

I currently have the open JDK version, but there are versions on Oracle's site (Are they the same thing?). I tried downloading and installing them once last December, but I wasn't sure how to proceed, which versions I needed, and it was somewhat confusing trying to find the answers on the web.

Please offer me any assistance if you can.
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Members online


Latest posts

Top