[Java] Java Installation in Linux
2010-02-20 18:57
190 查看
The passage is refered from http://dougdiego.com/2008/12/04/install-sun-jdk-on-fedora-10/
Install SUN JDK on Fedora 10
Installing the SUN JDK on Fedora is pretty simple. Here are some steps you can follow:
1. Go to: http://java.sun.com/javase/downloads/index.jsp
2. Click the download button next to: “Java SE Development Kit (JDK) 6 Update 11″ or which ever version you want.
3. On the next page, select Platform: “Linux” and Language: “Multi-language”. Click on Continue.
4. Then click on the file to download: jdk-6u11-linux-i586.bin This will download the file to your computer.
5. Next we need to make the file executable:
chmod a+x jdk-6u11-linux-i586.bin
6. Then run the installer:
./ jdk-6u11-linux-i586.bin
You’ll need to read the Terms & Conditions and accept them.
At this point you can use it as it or set it up more. Here is what I did.
7. As root I moved it to /usr/local
sudo mv jdk1.6.0_11 /usr/local
8. Then I updated my .bashrc to add it to my path:
vi ~/.bashrc
Add the following:
export JAVA_HOME=/usr/local/jdk1.6.0_11
export CLASSPATH=.:$JAVA_HOME/lib
export PATH=$PATH:$JAVA_HOME/bin
9. Now to use java either source the .bashrc like:
source ~/.bashrc
Or open a new terminal window.
Note 1: Note, these steps should work on most linux distros.
Note 2: If you already have OpenJDK installed, you can remove it with:
# yum remove java-1.6.0-openjdk java-1.6.0-openjdk-plugin
Note 3: If you are missing some dependancies, you can add them like:
# yum install compat-libstdc++-33 compat-libstdc++-296
Adding javac to your Path
To make javac available to any individual user, just add the following to each user’s path:
export JAVA_HOME=/usr/local/jdk1.6.0_11
export PATH=$PATH:$JAVA_HOME/bin
For example, if you have a user called doug, you’d open:
/home/doug/.bashrc
And add the 2 export command. (This assume you are using bash and the /home/doug is your home directory)
If you want to make is available to all users, as root edit the file:
/etc/profile
And again add:
export JAVA_HOME=/usr/local/jdk1.6.0_11
export PATH=$PATH:$JAVA_HOME/bin
If your shell is tcsh, you can add it here:
/etc/csh.cshrc
Firefox Plugin
You need to manuallly install the plugin. I followed the instructions in this thread: http://www.e-graviton.com/ird/node/195
On my Linux box, the plugins directory does not exist. So I have to create a new one first. Here are the steps:
1. Make a symbolic link:
$ mkdir plugins
$ pwd
/home/doug/.mozilla/plugins
$ ln -s /usr/local/jdk1.6.0_11/jre/plugin/i386/ns7/libjavaplugin_oji.so ./libjavaplugin_oji.so
$ ls
libjavaplugin_oji.so
$
2. Then I added the following lines to my .bash_profile
MOZ_PLUGIN_PATH=$HOME/.mozilla/plugins
export MOZ_PLUGIN_PATH
3. Log off and log on again, start the firefox, and I can run the java applet on linux!
Install SUN JDK on Fedora 10
Installing the SUN JDK on Fedora is pretty simple. Here are some steps you can follow:
1. Go to: http://java.sun.com/javase/downloads/index.jsp
2. Click the download button next to: “Java SE Development Kit (JDK) 6 Update 11″ or which ever version you want.
3. On the next page, select Platform: “Linux” and Language: “Multi-language”. Click on Continue.
4. Then click on the file to download: jdk-6u11-linux-i586.bin This will download the file to your computer.
5. Next we need to make the file executable:
chmod a+x jdk-6u11-linux-i586.bin
6. Then run the installer:
./ jdk-6u11-linux-i586.bin
You’ll need to read the Terms & Conditions and accept them.
At this point you can use it as it or set it up more. Here is what I did.
7. As root I moved it to /usr/local
sudo mv jdk1.6.0_11 /usr/local
8. Then I updated my .bashrc to add it to my path:
vi ~/.bashrc
Add the following:
export JAVA_HOME=/usr/local/jdk1.6.0_11
export CLASSPATH=.:$JAVA_HOME/lib
export PATH=$PATH:$JAVA_HOME/bin
9. Now to use java either source the .bashrc like:
source ~/.bashrc
Or open a new terminal window.
Note 1: Note, these steps should work on most linux distros.
Note 2: If you already have OpenJDK installed, you can remove it with:
# yum remove java-1.6.0-openjdk java-1.6.0-openjdk-plugin
Note 3: If you are missing some dependancies, you can add them like:
# yum install compat-libstdc++-33 compat-libstdc++-296
Adding javac to your Path
To make javac available to any individual user, just add the following to each user’s path:
export JAVA_HOME=/usr/local/jdk1.6.0_11
export PATH=$PATH:$JAVA_HOME/bin
For example, if you have a user called doug, you’d open:
/home/doug/.bashrc
And add the 2 export command. (This assume you are using bash and the /home/doug is your home directory)
If you want to make is available to all users, as root edit the file:
/etc/profile
And again add:
export JAVA_HOME=/usr/local/jdk1.6.0_11
export PATH=$PATH:$JAVA_HOME/bin
If your shell is tcsh, you can add it here:
/etc/csh.cshrc
Firefox Plugin
You need to manuallly install the plugin. I followed the instructions in this thread: http://www.e-graviton.com/ird/node/195
On my Linux box, the plugins directory does not exist. So I have to create a new one first. Here are the steps:
1. Make a symbolic link:
$ mkdir plugins
$ pwd
/home/doug/.mozilla/plugins
$ ln -s /usr/local/jdk1.6.0_11/jre/plugin/i386/ns7/libjavaplugin_oji.so ./libjavaplugin_oji.so
$ ls
libjavaplugin_oji.so
$
2. Then I added the following lines to my .bash_profile
MOZ_PLUGIN_PATH=$HOME/.mozilla/plugins
export MOZ_PLUGIN_PATH
3. Log off and log on again, start the firefox, and I can run the java applet on linux!
相关文章推荐
- Teamcenter10 step-by-step installation in Linux env-Oracle Server Installation
- Linux:Exception in thread "main" java.lang.NoClassDefFoundError
- Java Development Environment in Linux: Install and Configure Weblogic
- python delete only files in dir_Linux DB2 Java Python PHP Code Snippets_百度空间
- linux中tomcat启动错误:java.net.BindException: address already in use <null>:8443
- How-to create a Windows 10 usb installation media in Linux
- Deepin Linux安装ssh,遇到Package has no installation candidate问题解决方法
- Setting JAVA_HOME in Linux [zz]
- DEBUG Sigar - no libsigar-x86-linux.so in java.library.path
- opencv Installation in Linux and hello world
- Java Run As Service in Linux
- no libsigar-x86-linux.so in java.library.path
- Oracle XE Installation in Linux CentOS
- Unix/Linux installation in disk, without cdrom.
- Config The Java Environment In Linux
- Java Development Environment in Linux: Install and Configure Oracle
- Java Environment Building in Linux
- linux启动tomcat Cannot find any VM inJava Home /usr
- 2014-11-16:How to run java project(containing several package) in linux
- 在Linux中部署web项目 java.util.zip.ZipException: error in opening zip file