Windows installation
Since the acquisition of Java by Oracle, new versions of Java under Windows are installed only. No ZIP installation free.
The Windows installer has one downside
- Can write the registry
- Java. Exe,javaw.exe, etc
C:\Windows\System32
orC:\Windows\SysWOW64
- Will periodically update the program setting boot automatically, found the new version pop-up prompt
- Will be in
PATH
Write an Oracle javapath, will addjre\bin
The advantage is that it is easy to install
JAVA_HOME%\bin; JAVA_HOME%\bin; JAVA_HOME%\bin; A %JAVA_HOME%\jre\bin; And that led to a really weird mistake.
Now, how to avoid installation
From www.oracle.com/technetwork… Download the latest JDK for Windows installation: JDK – 8U131-Windows-x64.exe
Use the decompression software to unzip to E:\ jdK-8u131-windows-x64 \ Win+R-> CMD to open the command line
cd /d E:\jdk- 8 -u131-windows-x64\.rsrc\1033\JAVA_CAB10
extrac32.exe 111:: Decompress the tools.zip file :: Open the current folder Explorer. Exe. :: Decompress tools.zip to the current folder.`E:\jdk-8u131-windows-x64\.rsrc\1033\JAVA_CAB10\tools`:: Change the.pack file to a. Jar file CD toolsfor /r %x in (*.pack) do .\bin\unpack200 -r "%x" "%~dx%~px%~nx.jar":: Decompress src.zip. If you don't need the source code, skip this step. \.. \JAVA_CAB9 extrac32110:: Move src.zip to the Tools folder move src.zip.. \JAVA_CAB10\tools\ :: copy the contents of the tools folder to the specified directory, e.g. D:\ JDK xcopy /s /e/I /y e :\ JDK- 8 -u131-windows-x64\.rsrc\1033\JAVA_CAB10\tools d:\ JDK :: Delete E:\ JDK- 8 -U131-windows-x64 folder CD / &&rd /s /q E:\ JDK- 8 -u131-windows-x64Copy the code
Set the environment variable to add JAVA_HOME D :\ JDK
Change the PATH
Additional; %JAVA_HOME%\bin;
Add the CLASSPATH
.; %JAVA_HOME%\lib\dt.jar; %JAVA_HOME%\lib\tools.jar;
After setting the environment variables, you need to reopen CMD
java -version && javac -version
java version "1.8.0 comes with _131"
Java(TM) SE Runtime Environment (build 1.8. 0_131-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b15, mixed mode)
javac 1.8. 0_131Copy the code
Linux installation
# Download file
$ wget -P ~/downloads --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u121-b13/e9e7ea248e2c4826b92b3f075a80e441/jdk-8u121-linux-x64.tar.gz
# decompression
$ sudo tar zxf ~/downloads/jdk-*.tar.gz -C /usr/local/
Create a soft connection
$ sudo ln -sf /usr/local/ jdk1.8.0 _121 / usr /local/jdk
$ sudo vi /etc/profile
Set up the Java environment
export JAVA_HOME=/usr/local/jdk
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar; :$JAVA_HOME/lib/tools.jar:$CLASSPATH
export PATH=$JAVA_HOME/bin:$PATH
# Save and exit
# Make the configuration take effect
$ source /etc/profileCopy the code
My original
Blog anjia. Ml / 2017/05/17 /… Jane books www.jianshu.com/p/5dc20d5d4… The nuggets juejin. Cn/post / 684490…