Configuring the Java environment under Linux

Source: Internet
Author: User

1. The first thing to do is download the official website of Jdk,java SE 8 is http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Choose whether you want to use the 32-bit or 64-bit version, depending on your system version. Linux provides two ways to install one is. RPM and the other is. tar.gz, I'm using. tar.gz. Don't forget to select accept License agreement before downloading.

2. You can use the following command to see if your system is 32-bit or 64-bit

getconf LONG_BIT

3. Next we unzip the downloaded file

tar -zxvf jdk-8u102-linux-x64.tar.gz

4. Then we'll create a new directory and move the extracted files to the past.

mkdir /usr/javamv  ./jdk1.8.0_102 /usr/java

5. Then we set the environment variables, here we need to modify the/etc/profile file

Open/etc/profile file with vim first

vim /etc/profile

6. At the end of the file, add the following content

JAVA_HOME=/usr/java/jdk1.8.0_102export JRE_HOME=/usr/java/jdk1.8.0_102/jreexport CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATHexport PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

jdk1.8.0_102 Please make changes according to your actual file name.

After the add is complete, save and exit. The last step is to restart the computer.

reboot

After the computer restarts, we can enter Java in the terminal to detect whether the configuration was successful.

java

If the configuration is successful, a prompt message is displayed

Usage: Java[-options] Class[args...](Execution class) or Java[-options]-jar Jarfile[args...](Execute JAR fileOptions include:-d32 using the 32-bit data model(If available)-D64 using a 64-bit data model(If available)-server SelectThe "server" VM default VM is server because you are running on a server class computer. -cpClass search paths for < directories and Zip/jar files>-classpathClass search paths for < directories and Zip/jar filesFor >: Separate directories, JAR files, and ZIP archive lists for searching class files. -D< name>=< value> Set System Properties-verbose:[Class|gc|jni] Enable verbose output-version output product version and exit-version:< value> Warning: This feature is obsolete and will be removed in a future release. The specified version is required to run the-showversion output product version and Continue-jre-restrict-search| -no-jre-restrict-search Warning: This feature is obsolete and will be removed in a future release. Include/exclude user-specific JRE in version search-? -help output This Help message-X output non-standard option help-ea[:<packagename>...|:<classname>]-enableassertions[:<packagename>...|:<classname>] Enables assertions by the specified granularity-da[:<packagename>...|:<classname>]-disableassertions[:<packagename>...|:<classname>] Disables the assertion with the specified granularity-esa| -enablesystemassertions Enable System Assertion-DSA| -disablesystemassertions Disabling system assertion-agentlib:<libname>[=< options>] Load the native agent library<libnameFor example-agentlib:hprof See also-AGENTLIB:JDWP=help and-agentlib:hprof=help-agentpath:<pathname>[=< option > "load the native agent library by full pathname- Javaagent:<jarpath>< Span class= "Prism-token prism-punctuation" >[=< option >  load Java programming language proxy see Java.lang.instrument-splash:<imagepath> use the specified image to display the splash screen For more information, see Http://www.oracle.com/technetwork/java/javase/documentation/index.html. 

Configuring the Java environment under Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.