From http://blog.chinaunix.net/space.php? Uid = 20464521 & Do = Blog & id = 1673171linux and Windows install Java Linux
1. Go to the http://java.sun.com/j2se/1.4.2/download.html to download a Linux platform JDK, it is recommended to download RPM self-extract format (rpm in self-extracting file, j2sdk-1_4_2_06-linux-i586-rpm. Bin ).
2. Upload the file to a Linux server and run the following command in shell:
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.4.2 _ x
...
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_4_2_06-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_4_2_06-linux-i586.rpm file, this is the main package, the following to install:
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. bashr C file.
[Root @ linuxserver RPM] # vi. bashrc
Set java_home =/usr/Java/j2sdk1.4.2 _ 06
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 _ 06
Export classpath =.: $ java_home/lib/dt. Jar
: $ Java_home/lib/tools. Jar
Export Path = $ path: $ java_home/bin
Next, let's verify whether the variable settings take effect (#### Note: log out before verification, and then log on again ):
6. To allow a user to run Java commands, modify the bash initialization file. For example, longware has the following permissions to run Java commands:
[Root @ linuxserver root] #
VI/home/longware/. bashrc
Set java_home =/usr/Java/j2sdk1.4.2 _ 06
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. Extract To/OPT.
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.