0

I'm trying to run this applet (compiled in a way that the class file version is 54.0) in Linux from Terminal, and although I installed the latest version of java, it's version it's stuck to 1.8.0_181, with its Java(TM) SE Runtime Enviroment (build 1.8.0_181-b13).

With some research I managed to find out that I need to set the JRE to java 10 to run it, but I never found the answer that I needed, the steps. Many suggested Eclipse, but install it just to run an applet seems overkill to me, what can I do to set java up in a way that I can run this applet (whose class file is up to 54)?

p.s. I'm gonna be honest what I need are the STEPS to get me there.

B.Castarunza
  • 135
  • 12

2 Answers2

0

The current latest version of Java is 14. If you have Java 1.8, it's not the latest version.

If the package repositories for your Linux distribution don't include the latest version of Java, you can install it from:

Joni
  • 108,737
  • 14
  • 143
  • 193
  • So when you go to your terminal and input: java -version, what's the text that appears on your screen? – B.Castarunza Aug 26 '20 at 15:02
  • The text that appears is the version of Java that you are running at that moment. I'm currently using Java 11 from the OpenJDK distribution, and the "java -version" command output shows `openjdk version "11.0.8"` for me. If I were to remove Java 11 and install Java 14 instead, I would see it tell me I have Java 14. – Joni Aug 26 '20 at 15:26
  • @StephenC I've removed the comment with incomplete wording. So far the OP's problem seems to be that the "latest version of Java" they have installed is 1.8 and not the actual latest version. – Joni Aug 26 '20 at 15:27
  • I followed a tutorial to install the JDK 11 version, but I installed the JDK 14 version, but at the end of it it's still stuck at version 1.8, from what @Joni I should remove my current version of java(?), should I/ how do I do that? https://www.youtube.com/watch?v=72mz0-98vg8 (This is the tutorial btw) – B.Castarunza Aug 26 '20 at 15:37
  • Which Linux distribution (and distro version) are you using? Popular distributions are Ubuntu, Mint, Fedora, Debian. The way you uninstall Java, or make another version of Java the default, depends on the distribution you use. – Joni Aug 26 '20 at 15:43
  • Mine it's debian – B.Castarunza Aug 26 '20 at 15:54
  • ok. **step 1** Delete the oracle jdk the tutorial had you install manually **step-2** install Java 11 from debian packages: `sudo apt-get install openjdk-11-jdk` **step-3** run `update-alternatives --config java` to choose which version of Java you want to use as the default – Joni Aug 26 '20 at 16:16
  • Thank you so much! I really mean it! That command solved all my problems. I didn't delete the oracle jdk from the tutorial though, I selected it and installed it and now the programs run no problem! Again, thank a lot. – B.Castarunza Aug 26 '20 at 18:02
0

On Linux you can:

  • Run commands Java commands by giving the absolute path for the command.
  • Change the PATH environment variable so that the directory containing the Java executables is on the command path (in front of "/usr/bin" which is where the default Java commands will appear)
  • Use the alternatives tools to change what (for example) appletviewer refers to.

Note that Java 10 is the last version that will support appletviewer. Applets were deprecated in Java 8, and much of the applet support infrastructure was removed in Java 11; see Will it be possible to run Java applets with Java JRE 11?.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
  • Never heard of appletviewer, what's that and how can I access it? – B.Castarunza Aug 26 '20 at 15:03
  • Can't you just give me the terminal commands to run the proper version? – B.Castarunza Aug 26 '20 at 15:05
  • Where is your Java 10 installed? – Stephen C Aug 26 '20 at 15:06
  • So the commands "cd" or "cat" or "ls", are actually the commands' absolute paths? – B.Castarunza Aug 26 '20 at 15:06
  • No. They are command names. The absolute paths for "cat" and "ls" are "/bin/cat" and "/bin/ls". (And "cd" is a shell built-in command, so it doesn't have a path at all.) This is all basic Linux stuff. You would do best finding and doing a Linux tutorial ... – Stephen C Aug 26 '20 at 15:09
  • Or if you couldn't be bothered, read this: https://www.cyberciti.biz/faq/linux-unix-set-java_home-path-variable/ – Stephen C Aug 26 '20 at 15:21
  • I followed a pseudo linux tutorial, where they taught you the general stuff, that's why I miss the basics, but an entire Linux tutorial would be too much in my opinion, complementing it by asking questions seems more efficient to me, and today I learned this new basic thing thanks to you Stephen, thank you very much – B.Castarunza Aug 26 '20 at 15:21