Compiling/Running With A Specific Java JDK On Linux Ubuntu

I’m wondering how to compile/run Java programs with specific versions of the JDK/JRE on Linux. I have the J2 SE 1.3 JDK downloaded, and extracted on my desktop in Ubuntu.
I can do this on Windows with:

cd C:\Users\X\Desktop
"C:\Program Files\Java\jdk1.7.0_80\bin\javac.exe" Main.java
"C:\Program Files\Java\jdk1.7.0_80\bin\java.exe" Main

or on Mac OS with this:

cd ~/Desktop
/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home/bin/javac Main.java
/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home/bin/java Main

I might have even done this before, but I can’t get it working now/anymore. I would appreciate it if someone could show me how to do this.

I FINALLY GOT IT

cd ~/Desktop
X/bin/i386/Y/javac Z.java

X = Exact folder name
Y = Exact folder name, either “green_threads” or “native_threads”
Z = Exact Java file name

Like Mac OS, you do NOT use quotation marks, unlike Windows.

…Unfortunately… I got an error message -.- (with Java 2 SE 1.3)
Message:

jdk1.3.1_20/bin/i386/native_threads/javac: error while loading shared libraries: libhpi.so: cannot open shared object file: No such file or directory

Windows uses %PATH% to hold a list of folders where it will look for executable files, macOS and Linux use $PATH. Filenames can depend on what’s handling them. Before the shell gives commandline parameters to javac, it expands * and $item aliases, and presents a space-separated list of parameters. You can put single quotes around things you don’t want the shell to touch, and double quotes around things you want the shell to expand while allowing you special characters like [space] and [plain-brackets ()].

For that library error, you may need to add other resources, especially stuff on i386 architecture, to your system to have the supporting libraries you need. More details are in my reply to your other thread.

K3n.