Pages

Friday, January 11, 2008

How to install java on linux

After to have been through the net for a long time to configure correctly java on linux i've written this article to solve this issue.

Steps to install correctly java in linux:

-Let's supose java is installed under the directory /j2ee

Steps:

1.Create a file vi /etc/profile.d/java.sh
2.Insert he follow lines:

export PATH=/j2ee/java/jdk/jre/bin:$PATH
JAVA_HOME=”/j2ee/java/jdk”
export JAVA_HOME
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=$JAVA_HOME/lib/tools.jar
export CLASSPATH=$CLASSPATH:.
3.Make it executable this file running this sentence:

chmod 755 /etc/profile.d/java.sh
4.After that, let's install the plugin for firefox:

The plugin you have to use depends of the version the browser was compiled. Generally it was done with gcc 3.x, so execute:

ln -s /j2ee/java/jdk/jre/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/firefox/plugins

If the gcc is 2.96

ln -s /j2ee/java/jdk/jre/plugin/i386/ns7-gcc29/libjavaplugin_oji.so /usr/lib/firefox/plugins

5.To install the preferences edit the file /usr/share/applications/sun_java.desktop to look like this:

[Desktop Entry]
Name=Java
Comment=Java Control Panel
Exec=/j2ee/java/jdk/jre/bin/ControlPanel
Icon=/j2ee/java/jdk/jre/plugin/desktop/sun_java.png
Terminal=0
Type=Application
Categories=Application;Settings;

6.To test the configuration, restart you're pc and after run on a terminal:

which java
which javac
echo $JAVA_HOME
echo $PATH
echo $CLASSPATH

If everything works you have configured right you're JVM to start to develop and run java applications.


Now on a web browser window write: about:plugins, you have to see all the java MIME Types listed there.

Finally go to /usr/share/applications and search and execute sun_java.desktop it has to run the preferences of Java version installed on the machine

Greetings.

This article has been written using this references:

http://www.linuxparatodos.net/portal/staticpages/index.php?page=como-java
http://www.linux.com/base/ldp/howto/Enterprise-Java-for-Linux-HOWTO-2.html