Establishment of java Runtime Environment In Debian Linux

Source: Internet
Author: User
For details about how to create a java Runtime Environment In Debian Linux-Debian Technology for Linux release, see the following. 1. First download a Linux Platform JDK, I am under the jdk-1_5_0-linux-i586-rpm.bin
It is recommended to download RPM in self-extracting file (jdk-1_5_0-linux-i586-rpm.bin) in RPM in self-extracting format );
2. Upload the file to a Linux machine and run the following command in shell:
[Root @ LinuxServer rpm] # chmod 755 jdk-1_5_0-linux-i586-rpm.bin
[Root @ LinuxServer rpm] #./j2sdk-1_4_2_07-linux-i586-rpm.bin
There will be a piece of Sun Protocol, several times the Space key, when asked whether to agree, you can press yes.
Sun Microsystems, Inc.
Binary Code License Agreement
For
JAVATM 2 software development kit (J2SDK), STANDARD
EDITION, VERSION 1.5.0
...
Do you agree to the above license terms? [Yes or no] yes
Unpacking...
Checksumming...
0
0
Extracting...
UnZipSFX 5.40 of 28 November 1998, by Info-ZIP (Zip-Bugs@lists.wku.edu ).
Inflating: j2sdk-1_5_0-linux-i586.rpm
Done.

Note: If you run the unzip command directly to decompress the package, you can obtain an rpm package.

3. The program will automatically generate a j2sdk-1_5_0-linux-i586.rpm file, which is the main package, debian to use alien installation;
[Root @ LinuxServer rpm] # rpm-I jdk-1_5_0-linux-i58.rpm
Preparing... ######################################## ### [100%]
1: j2sdk ####################################### #### [100%]

4. Set Environment Variables
Usually, you prefer to use the export command to directly set it in shell.
[Root @ LinuxServer rpm] # export JAVA_HOME =/usr/java/j2sdk1.4.2 _ 07
[Root @ LinuxServer rpm] # export CLASSPATH =.: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar
[Root @ LinuxServer rpm] # export PATH = $ PATH: $ JAVA_HOME/bin
Of course, this setting of environment variables takes effect only for the current shell.
If you log on from another shell, you cannot use the variable you just set. So the best way is to modify the. bashrc file.
[Root @ LinuxServer rpm] # vi. bashrc
Set JAVA_HOME =/usr/java/j2sdk1.4.2 _ 07
Export JAVA_HOME
Set PATH = $ PATH: $ JAVA_HOME/bin
Export PATH
Set CLASSPATH =.: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar
Export CLASSPATH
Of course, you can also change/etc/profile, but this is not recommended,
This setting will take effect for the user's shell and affect system security.
Add the following at the end of the file:
Export JAVA_HOME =/usr/java/j2sdk1.4.2 _ 07
Export CLASSPATH =.: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar export PATH = $ PATH: $ JAVA_HOME/bin
Next, verify whether the variable settings take effect (#### Note: log out before verification, and then log on again );
[Root @ LinuxServer rpm] # echo $ JAVA_HOME
/Usr/java/j2sdk1.4.2 _ 07/
[Root @ LinuxServer rpm] # echo $ CLASSPATH
/Usr/java/j2sdk1.4.2 _ 07/lib/dt. jar:/usr/java/j2sdk1.4.2 _ 07/lib/tools. jar
[Root @ LinuxServer rpm] # echo $ PATH
/Usr/java/j2sdk1.4.2 _ 07/bin/:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:
/Usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin
[Root @ LinuxServer rpm] # JAVA-version
JAVA version "1.4.2 _ 07"
JAVA (TM) 2 Runtime Environment, Standard Edition (build 1.4.2 _ 07-b03)
JAVA HotSpot (TM) Client VM (build 1.4.2 _ 07-b03, mixed mode) 5. Set the environment to OK to see if JDK works properly. Let's write a test file test. java
[Root @ LinuxServer rpm] # vi test. java
Class test
{
Public static void main (String [] args)
{
System. out. println ("Hello World! ");
}
}
Save and exit. Compile and execute the command below;
[Root @ LinuxServer text] # javac test. java
[Root @ LinuxServer text] # JAVA test
Hello World!
OK. The operation is normal.
6. To allow a user to run java commands, modify the bash initialization file.
For example, to grant longware the permission to run java commands,
[Root @ LinuxServer root] # vi/home/longware/. bashrc
Set JAVA_HOME =/usr/java/j2sdk1.4.2 _ 07
Export JAVA_HOME
Set PATH = $ PATH: $ JAVA_HOME/bin
Export PATH
Set CLASSPATH =.: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar export CLASSPATH

7. Now, JDK installation on Linux is complete. Install eclipse-sdk-3.0-linux-gtk.zip below
Go to www.eclipse.orgto download a eclipse3.0unzip eclipse-sdk-3.0-linux-gtk.zip to/opt
8. Write a script to start eclipse
#! /Bin/bash
#
# Execute eclipse 3
#
Export JAVA_HOME =/usr/java/j2sdk1.4.2 _ 07
Export CLASSPATH =/usr/java/j2sdk1.4.2 _ 07/lib
/Opt/eclipse-vm/usr/java/j2sdk1.4.2 _ 07/bin/java-data/home/chenzhe/workspace &
#-Vm parameters are used to specify which jvm is used to execute Eclipse,
# The-date parameter is used to specify the Eclipse data directory.
Specify that it exists in the workspace directory under the user root directory (/home/chenzhe /)
Save the script to/usr/local/bin, called eclipse, and assign 755 permissions to eclipse.
9. Create a starter on the desktop. Select an icon and set the path to/opt/eclipse./opt/eclipse/icon. xpm is the eclipse icon.
10. Double-click the icon or enter eclipse on the terminal!
Related Article

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.