Install Glassfish, JDK and Netbeans on Ubuntu (Manual)

I have always used manual way to install JDK, Glassfish and Netbeans in Linux platform, due to slower Internet connection. Among three, installing JDK manually is a bit lengthier. Before we start make sure to download latest version of all three softwares (like : jdk-6u23-linux-i586.bin, glassfish-installer-v2ur2-b04-linux.jar and netbeans-6.9.1-ml-linux.sh).

For JDK install :

Login as root and change the file permission with chmod

sudo chmod a+x jdk-6u23-linux-i586.bin
sudo ./jdk-6u23-linux-i586.bin

Press space bar continuously or ‘q’ to reach where system prompt yes or no. Choose yes and continue. You can move the installed jdk file directory to /usr/local or else as need.

sudo mv jdk1.6.0_23/ /usr/local/

In order to use the various Java terminal commands (such as java & javac) with the JDK that we just installed, the JAVA_HOME and PATH variables need to be set. This involves editing a text file, however, you have to edit a different text file depending on whether you want to set up the variables system wide or just for an individual user.

Settings the variables up system wide
To set the variables up system wide either the /etc/profile file or the /etc/bash.bashrc need to be edited. Execute following :

sudo -i
echo "export JAVA_HOME=/usr/local/jdk1.6.0_23/bin/java" >> /etc/profile
echo "export PATH=$PATH:/usr/local/jdk1.6.0_23/bin" >> /etc/profile
exit

Settings the variables up for a single user

echo "export JAVA_HOME=/usr/local/jdk1.6.0_23/bin/java" >> $HOME/.profile
echo "export PATH=$PATH:/usr/local/jdk1.6.0_23/bin" >> $HOME/.profile

Setting up the default JRE
Linux platform by default have open jre installed. If you decided to remove the default JRE (OpenJDK JRE) this section is necessary for Java applications to run correctly.

sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/jdk1.6.0_23/jre/bin/java" 1
sudo update-alternatives --set java /usr/local/jdk1.6.0_23/jre/bin/java

For Glassfish :
Installing glassfish is the easiest among with few setup time and commands.

java -Xmx256m -jar glassfish-installer-v2ur2-b04-linux.jar

This command will unbundle GlassFish and create a new directory structure rooted under a directory named ‘glassfish’. You may ask to accept the terms and condition. Which do so. Go to glassfish directory and execute following :

chmod -R +x lib/ant/bin
lib/ant/bin/ant -f setup.xml 

For GlassFish V2 with Clustering supported installation, just change step 4 from the above installation

lib/ant/bin/ant -f setup-cluster.xml 

For Netbeans :
Installing Netbeans is also relatively easy. Just follow these steps and it will be all done.

sudo chmod a+x netbeans-6.9.1-ml-linux.sh
sudo ./netbeans-6.9.1-ml-linux.sh

Now, just choose some option and proceed.

Leave a comment

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.