Not sure if this is the right place -- or even site -- to post this, but here goes:
I've dabbled with Linux in the past, but my MB pro is dying sadly -- started yesterday, in fact (something with the backlight; it sort of slight dims periodically, and at the bottom of the display, it looks like a series of spotlights shining upward, if that makes sense) -- 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 getting tired of apple anyway -- not what it used to be.
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
After compiling the file, and trying to run it I get this:
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 ask, 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. I wish to stress that my knowledge of Linux is very slight at this point, and I just want to get Java going on it, while I learn more about Linux. Does that make sense?