Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set Java environment variable problem on ubuntu

Tags:

java

linux

I got a message "No Java virtual machine could be found from your PATH environment variable. You must install a VM prior to running this program." Does anyone know how set up it correctly? Thanks!

like image 869
Sinal Avatar asked Dec 04 '22 14:12

Sinal


1 Answers

If you install Java the Ubuntu way, you won't have to add it to the PATH yourself.

First, install Java from the Ubuntu repository:

sudo apt-get install sun-java6-jre

There are several other packages: sun-java6-jdk for the JDK, sun-java6-plugin for the browser plug-in etc.

Use Ubuntu's alternatives mechanism to select Sun Java 6 as the default version of Java that you want to use:

sudo update-alternatives --config java

This will present you with a menu where you can choose which version of Java you want to use by default (you can have multiple Java versions installed at the same time on your system).

See: https://help.ubuntu.com/community/Java

like image 84
Jesper Avatar answered Dec 11 '22 16:12

Jesper