1

This question already has an answer here:

Ubuntu noob here. When using Windows I just copy paste this in cmd:

set Path=C:\Program Files\Java\jdk1.8.0_60\bin
set HomePath= C:\Program Files\Java\ jdk1.8.0_60

What would the syntax for this be in Ubuntu? assuming /usr/bin/java. A concise answer would be appreciated.

marked as duplicate by muru, Eric Carvalho, Ravan, David Foerster, hg8 Dec 19 '15 at 17:22

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0

Here it is:

JAVA_HOME=/usr/lib/jvm/jdk1.8.0
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
1

Like the other answer said, the linux equivalent is this:

JAVA_HOME=/path/to/your/jdk
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin

But how will you find out the /path/to/your/jdk? (Assuming you are a noob here). For that, you will have to run this command:

which java

which is a standard linux command that gives you the full path to any file (or blank if the file isn't locatable). This will return you a path like /usr/lib/jvm/jdk1.8.0_05/bin, and after removing the /bin at the end, you can take the rest of path and assign it to JAVA_HOME.

Hope that helps.

Not the answer you're looking for? Browse other questions tagged or ask your own question.