1, install JDK 1.1, download JDK related to the official website here download is jdk-6u24-linux-i586.bin. : Development "folder input: sudomkdir. java will download the jdk-6u
1. Install JDK
1.1 download the related JDK from the official website.
Here the download is jdk-6u24-linux-i586.bin.
: Http://www.Oracle.com/technetwork/java/javase/downloads/index.html
1.2 create a hidden "Java" folder in the "Main folder ".
Input:
Sudo mkdir. java
Place the downloaded jdk-6u24-linux-i586.bin in this Java folder.
Input:
Sudo cp jdk-6u24-linux-i586.bin. java
You can modify the path according to your actual situation. Here we use the Java folder in the main folder as an example.
1.3 install JDK
Under the. java file directory
Input:
Sudo sh jdk-6u24-linux-i586.bin
(The user password to be entered may be encountered)
2. Set system variables in the JAVA_HOME environment (three methods are available)
Note: In the following operations,/home/glc/. java/jdk1.6.0 _ 24 is my Java installation directory. You can modify the directory based on your actual situation.
Method 1: Modify the/etc/profile file
All users' shells have the right to use these environment variables.
Run the following command on the shell terminal:Vi/etc/profile
Add the following content to the end of the profile file:
JAVA_HOME =/home/glc/. java/jdk1.6.0 _ 24
PATH = $ JAVA_HOME/bin: $ PATH
CLASSPATH =.: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar
Export JAVA_HOME, PATH, CLASSPATH
Restart the system
Method 2: Modify the. bashrc File
If you want to grant a user the permission to use these environment variables, you only need to modify the. bashrc in the home directory of the user, unlike the first method to grant permissions to all users.
Run the following command on the shell terminal:Vi/home/username/. bashrc
Add the following content to the end of the. bashrc file:
Set JAVA_HOME =/home/glc/. java/jdk1.6.0 _ 24
Export JAVA_HOME
Set PATH = $ JAVA_HOME/bin: $ PATH
Export PATH
Set CLASSPATH =.: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar
Export CLASSPATH
Log on again
Method 3: directly modify it in shell
Used for temporary use in Shell. Changing a Shell is invalid.
Input:
Export JAVA_HOME =/home/glc/. java/jdk1.6.0 _ 24
Export CLASSPATH =.: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar
Export PATH = $ JAVA_HOME/bin: $ PATH
Note: Linux uses: (colon) instead of (semicolon) to separate paths.
Log out of the user and check the JDK version.
Input:
Java-version
If the correct version information is displayed, JRE and JDK are successfully installed.
3. Install Eclipse.
3.1 download related Eclipse from the official website.
Here the download is eclipse-java-helios-SR2-linux-gtk.tar.gz (that is, Java SE ).
: Http://www.eclipse.org/downloads/
3.2. Place the downloaded eeclipse-java-helios-SR2-linux-gtk.tar.gz in the Java folder and decompress it.
Input:
Sudo cp eclipse-java-helios-SR2-linux-gtk.tar.gz. java
Cd. java
Tar zxvf eclipse-java-helios-SR2-linux-gtk.tar.gz
3.3 Add a panel starter:
Right-click the Panel and choose add to Panel> Custom application launcher> Add and enter the following information:
Name: Eclipse
Command:/home/glc/. java/eclipse
Modify the icon (icon address:/home/glc/. java/eclipse/icon. xpm)
3.4 add to menu:
Enter:
Sudo gedit/usr/share/applications/Eclipse. desktop
The content is as follows:
[Desktop Entry]
Encoding = UTF-8
Name = Eclipse
Comment = Eclipse IDE
Exec =/home/glc/. java/eclipse
Icon =/home/glc/. java/eclipse/icon. xpm
Terminal = false
Type = Application
Categories = GNOME; Application; Development;
StartupNotify = true
Now you can use Eclipse normally, Good Luck!
Other methods for installing JDK:
1. Use shell commands to install:
Sudo add-apt-repository "deb http://archive.canonical.com/lucid partner"
Sudo apt-get update
Sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts
2. Install using the PPA Source:
Sudo add-apt-repository ppa: sun-java-community-team/sun-java6
Sudo apt-get update
Sudo apt-get install sun-java6
You can also search for eclipse to install the latest Eclipse in the shell or Ubuntu Software Center.