In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how to install the Java environment in debian. I hope you will get something after reading this article. Let's discuss it together.
1. Get the JDK of sun
You can choose to download from the official Java: http://java.sun.com or other websites
JRE (J2RE)
Java Runtime Environment-if you don't plan to create your own Java application, just install it.
JDK (J2SDK)
Java Development Kit-Java's software open tool. If you need to create your own Java application, you need to choose JDK. Exe.
The latest version is:
JDK: jdk-1_5_0_06-linux-i586.bin
JRE: jre-1_5_0_06-linux-i586.bin
Note: JRE is already included in SDK. Below, take JDK as an example.
two。 Build a packaging environment
Fortunately, Debian provides us with SDK's DEB package building tool: java-package
# apt-get install-u java-package fakeroot
Note: update the package list before installation
3. Create a .deb package
Run as a normal user:
$fakeroot make-jpkg jdk-1_5_0_06-linux-i586.bin
In the process, there may be some warning messages and make some necessary choices. After a few minutes, you should be prompted that the package was created successfully. So congratulations, you'll find something like this in the current directory:
Sun-j2sdk1.5_1.5.0+update06_i386.deb
Software package of
4. Installation
You should switch to the root user to execute the following command:
# dpkg-I sun-j2sdk1.5_1.5.0+update06_i386.deb
Of course, you should specify the correct package name as appropriate. This is easy to do. Just check the current directory.
5. Configure the environment
Add something similar to the following in the / etc/profile (or ~ / .bashrc) script file
PATH=$PATH:/usr/lib/j2sdk1.5-sun/bin:/usr/lib/j2sdk1.5-sun/jre/bin
JAVA_HOME=/usr/lib/j2sdk1.5-sun
JRE_HOME=/usr/lib/j2sdk1.5-sun/jre
CLASSPATH=.:/usr/lib/j2sdk1.5-sun/lib/tools.jar:/usr/lib/j2sdk1.5-sun/lib/dt.jar
Export PATH
Export JRE_HOME
Export JAVA_HOME
Export CLASSPATH
6. test
Set the current default java interpreter update-alternatives-- config java
After execution, a picture similar to the following appears:
There are 4 alternatives which provide `java'.
Selection Alternative
1 / usr/bin/gij-wrapper-4.1
* + 2 / usr/lib/jvm/java-gcj/jre/bin/java
3 / usr/lib/jvm/java-1.5.0-sun/jre/bin/java
Press enter to keep the default
, or type selection number:3
Enter the number in front of the line that contains "sun". As shown above, enter 3, and then enter enter to confirm.
A simple test. All you have to do is execute the command:
$java-version
You should see some information about the java version similar to the following:
Java version "1.5.02.06"
Java (TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot (TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)
A slightly more troublesome test
Create a simple java program (Hello.java)
Public class Hello {
Public Hello () {
}
Public static void main (String [] args) {
System.out.println ("Hello World!")
}
}
And then
$javac Hello.java
Check that the current directory will become a file named Hello.class, and then run
$java Hello
Hello World!
OK, the test is successful!
7. Install the plug-in
For Java environments installed in this way, the browser plug-in file location should be located in:
$JAVA_HOME/jre/plugin/arch/ns7/libjavaplugin_oji.so
For example: / usr/lib/j2sdk1.5-sun/jre/plugin/i386/ns7/libjavaplugin_oji.so
Take firefox (> 1.0) as an example:
# cd / usr/lib/mozilla-firefox/plugins
# ln-s
/ usr/lib/j2sdk1.5-sun/jre/plugin/i386/ns7/libjavaplugin_oji.so
Or in the Debian way:
# update-alternatives-verbose-install
/ usr/lib/mozilla-firefox/plugins/libjavaplugin.so
Firefox-javaplugin.so
$JAVA_HOME/jre/plugin/i386/ns7-gcc29/libjavaplugin_oji.so 500
Then, restart the browser and browse the test web page: http://serios.net/content/applets/viewinfoawt.php
8. Unloading
Uninstall the package:
# apt-get remove-purge sun-j2sdk1.5
Uninstall the plug-in and delete the symbolic link directly:
# rm / usr/lib/mozilla-firefox/plugins/libjavaplugin_oji.so
If you installed the plug-in using the update-alternatives command, you can delete it by executing the following command:
# update-alternatives-remove firefox-javaplugin.so
$JAVA_HOME/jre/plugin/i386/ns7/libjavaplugin_oji.so
9. Chinese culture
Install Chinese fonts:
Create a fallback directory under the $JAVA_HOME/jre/lib/fonts/ directory.
Copy Chinese fonts (e.g. simsun.ttf) to this directory.
After reading this article, I believe you have a certain understanding of "how to install Java environment in debian". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 237
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.