Showing posts with label jdk. Show all posts
Showing posts with label jdk. Show all posts

Wednesday, 31 August 2011

Installing Java JDK Linux Simple Steps

There are many of ways to install the Java Development kit onto Linux operating systems. This includes installing from yum repositories. However some of these versions of java my have components missing.

The following is one of the most simplest way and ensure all of the JDK components are installed:

1. Download the compressed binary from the Java site. For example

wget http://download.oracle.com/otn-pub/java/jdk/7/jdk-7-linux-x64.tar.gz


2. Once downloaded run tar -xzvf on the file

3. mv the directory to /usr/local/

4. Append a reference to the directory your local profile

e.g.  vi ~/.bash_profile

add the following:

export JAVA_HOME=/usr/local/jdk1.7.0
export PATH=$PATH:/usr/local/jdk1.7.0/bin


3. Log out and back in again. Run java -version to confirm installation

Tuesday, 30 November 2010

Installing Grails on Linux

Before installing or using Grails, set JAVA_HOME environment variable:

1. Add the following to  ~/.profile

export JAVA_HOME=/usr/local/jdk1.6.0_27/
export PATH=$PATH:/usr/local/jdk1.6.0_27/bin

Location will be where JDK is installed to.

2. Log out and back in again, run echo $JAVA_HOME and echo $PATH to confirm. Also check by typing java -version.

To install Grails:

1. Download grails from http://www.grails.org/Download
2. Extract the archive into a home directory. Typically /usr/local in Linux
3. Append a reference to grails as a variable, as with JAVA_HOME above

export GRAILS_HOME=/usr/local/grails-1.3.7/
export PATH=$PATH:/usr/local/grails-1.3.7/bin


Location path will be the directory you saved the extracted files to.

4. Log out and back in again.
5. Type grails in a terminal window to test. You should see:


Welcome to Grails 1.3.5 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /home/lee/grails-1.3.5

No script name specified. Use 'grails help' for more info or 'grails interactive' to enter interactive mode


You can now begin writing grails applications

Writing your first Java application

In order to test if your Java JDK installation is working correctly the best thing to do is write a simple Hello App!

1. Open a terminal window
2. Create a new java file, e.g. vi Hello.java
3. Write a basic program to announce some text or comment:

public class Hello {
        public static void main(String[] args) {
                System.out.println("I am a java App!");
        }
}


4. Save the file
5. Run javac Hello.java (This should complete without any errors)
6. Run java Hello
7.  I am a java App! appears in the terminal

Installing Java SDK Linux - Ubuntu

Having never used Linux before when you first starting using any Linux flavor, even the most simplest of tasks performed under Microsoft operating systems can cause you some trouble.

For programming and general purpose user I required  Java JDK and JRE installed on my Ubuntu machine. See basic steps below on how this install takes place.

Installation of Java JRE

You can download the source code or self extracting binaries from the Sun Java site, however the quickest way on this OS is to complete the following:

1. Open a terminal window
2. Run sudo vi '/etc/apt/sources.list'
3. Add the following line to the bottom of the file:
deb http://archive.canonical.com/ lucid partner
4. Run sudo apt-get install sun-java6-jre sun-java6-plugin sun-java6-fonts
5. Accept all license terms etc..
6. Run java from terminal window to confirm installation

Installation of Java JDK (for developers)


You can download the source code or self extracting binaries from the Sun Java site, however the  quickest way on this OS is to complete the following:

1. Open a terminal window
2. Run sudo apt-get install sun-java6-jdk
3. Run java -version to confirm installation