简体   繁体   中英

Vagrant java 1.6 to 1.8

I Installed vagrant on my machine with hashicorp-precise32 virtual machine. It installed java 1.6 whereas i want java 1.8 . Do i have to install another virtual machine? How to get java 1.8?

Add below lines in your Vagrantfile , It will install Java 8 (accepting licenses) and also set the Environmental variables in your guest VM:

sudo apt-get install -y software-properties-common python-software-properties
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
sudo add-apt-repository ppa:webupd8team/java -y
sudo apt-get update
sudo apt-get install oracle-java8-installer
echo "Setting environment variables for Java 8.."
sudo apt-get install -y oracle-java8-set-default

Moreover, you can refer Creating and Provisioning VM using Vagrant

It depends on the os you put on the virtualbox, the one you installed has ubuntu so you will want to follow instructions from here

$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java8-installer
$ sudo apt-get install oracle-java8-set-default

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM