Build a java Development Environment under Ubuntu

Source: Internet
Author: User

JDK installation:

1.

2. I usually install non-system software under/opt.

Sudo cp/home/yourname/Doenloads/jdk-7u45-linux-x64.tar.gz/optcm/opt sudo tar-zxvf jdk-7u45-linux-x64.tar.gz. (unzip to/opt directory)

3. Set Environment Variables

Add JDK configuration information to/etc/profile:

Add the following content at the end of sudo gedit/etc/profile: # set jdk environtexport JAVA_HOME =/opt/jdk1.7.0 _ 45 export JRE_HOME =/opt/jdk1.7.0 _ 45/jreexport CLASSPATH =.: $ CLASSPATH: $ JAVA_HOME/lib: $ JRE_HOME/libexport PATH = $ PATH: $ JAVA_HOME/bin: $ JRE_HOME/binsource/etc/profile (for the configuration to take effect)

Note the following When configuring the environment:

  • Pay attention When configuring CLASSPATH and PATH. If there is a problem with the configuration, it may fail to enter the desktop. For example, if you write ".: CLASSPATH" in the CLASSPATH path as ": CLASSPATH" or other statements, the problem may occur. It doesn't matter if the problem occurs. Press Ctrl + Alt + F1 to enter the command line mode, correct the corresponding configuration, and then press Ctrl + Alt + F7 to return to the desktop.

    Another point is that when you configure the environment, do not leave spaces between the Environment name and the corresponding environment path, such as JAVA_HOME =/opt/jdk1.7.0 _ 45 "=" on both sides, which should be unrecognized by bash.

    4. Because ubuntu comes with the JVM Implementation of gij, the following information is displayed when you type "java-version" on the terminal: java version "1.6.0. This means that the JVM implementation is already available in the system, and gij JVM is the default JVM implementation (used by other ubuntu tools or software ). In this case, you need to use the "update-alternatives" tool provided by Debian to complete the selection of Multi-version implementations:

    Sudo update-alternatives -- display java found that the system only lists gij JVM, because JDK 7 is manually decompressed and installed. Sudo update-alternatives -- install/usr/bin/java/opt/jdk1.7.0 _ 45/bin/java 50 sudo update-alternatives -- install/usr/bin/javac/opt/ jdk1.7.0 _ 45/bin/javac 50 sudo update-alternatives -- install/usr/bin/javah/opt/jdk1.7.0 _ 45/bin/javah 50 sudo update-alternatives -- install/usr /bin/javaws/opt/jdk1.7.0 _ 45/bin/javaws 50 sudo update-alternatives -- install/usr/bin/javap/opt/ Jdk1.7.0 _ 45/bin/javap 50 is actually OK as long as java and javac are set. The 50 at the end of the row is the priority. Ls-l/etc/alternatives/java found that the JVM has pointed to the extract directory lrwxrwxrwx 1 root 25 October 24 16:23/etc/alternatives/java->/opt/jdk1.7.0 _ 45/ bin/javasudo update-alternatives -- config java select the JDKjava-version that has just been installed and it is already java version 1.7.0.




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.