antonpuz
antonpuz

Reputation: 3316

What is the default source of java JRE linux

I am running a JAVA program on linux machine which requires java JRE 1.8, The problem is that it only works if I manually add the source ../java32/jdk1.8.0_05/jre/bin to the PATH environment variable.

I want to use the program via ssh using direct access to it

ssh user@ip "./program"

When accessing via ssh it work since the route isnt added when the program is called (I add it to the PATH manually in the .bashrc file)

I cant find where is the default source set, I tried the following: 1. Running the config:

 alternatives --config java

It gives the following result as chosen which seems right:

 + 3           /opt/jdk1.8.0_31/bin/java
  1. checking /usr/java gives the following connections:

    lrwxrwxrwx 1 root root   16 Feb 10 16:12 default -> /usr/java/latest
    drwxr-xr-x 9 root root 4096 Feb 10 16:16 jdk1.8.0_31
    drwxr-xr-x 7 root root 4096 Feb 10 16:12 jre1.8.0_31
    lrwxrwxrwx 1 root root   21 Feb 10 16:17 latest -> /usr/java/jdk1.8.0_31
    

Any ideas on what else can be done to solve it?

Upvotes: 0

Views: 144

Answers (1)

Francesco Gualazzi
Francesco Gualazzi

Reputation: 939

You can use /usr/java/latest as $JAVA_HOME, that will be in your $PATH automatically in most distros.

To test it:

ssh user@host "/usr/java/latest/bin/java -version"

Upvotes: 2

Related Questions