Friday, September 26, 2008

How Fast Does A 4hp Motor Go

Install Java Development Kit (JDK) and Java Runtime Environment (JRE) in Ubuntu Linux console

This short tutorial will explain how to install the correct JRE version of Linux, because when we will download files from the Sun

page there are so many that sometimes do not know what to install. Installation

tested ubuntu 7.10 desktop, Ubuntu 8.04 desktop and server.

Packages needed:


=>
sun-java6-bin

: Sun Java Runtime Environment (JRE) 6 =>
sun-java6-demo
: Sun Java Development Kit (JDK) 6 demos
=>
sun-java6-jdk => sun-java6-jre : Sun Java Runtime Environment (JRE) 6


Install Sun Java 6

Open a shell (terminal) and type the following to install JDK and JRE:
  1. $ sudo apt-get install sun-java6-bin sun-java6-jre sun-java6-jdk
  2. here displays a message indicating all the dependencies of packages to install, press S to accept.
  3. Default install Java version
  4. Ubuntu Linux comes with update-java-alternatives utility updates all the alternatives that belong to a development kit for Java. To select, Sun JVM as provided type:
  5. $ sudo update-java-alternatives-s java-6-sun
also need to edit a file called / etc / jvm
. This file defines the default search order system for jvm (java virtual machine). Each list of JVM in JAVA_HOME should be in this file. The default system JVM is the first one available from top to bottom. Open
/ etc / jvm


$ sudo vi / etc / jvm

sure to add
/ usr/lib/jvm/java-6-sun
at the top of the list JVM.
The file should read:


/ usr/lib/jvm/java-6-sun

/ usr / lib / jvm / java-gcj
/ usr / lib / jvm / ia32-java-1.5.0-sun
/ usr/lib/jvm/java-1.5.0-sun

/ usr

Save and close the file. (Esc: wq)

Setting environment variable
also need to set JAVA_HOME and PATH (system wide) configuration . Open your $ HOME /. Bash_profile or / etc / profile:
$ vi $ HOME / .bash_profile
Add line:
export JAVA_HOME = / usr/lib/jvm/java-6-sun export PATH = $ PATH: $ JAVA_HOME / bin

Save and close the file. (Esc: wq)

Test your new JDK

Type the following command to display the version:
$ java-version
should display a message like this
:


java version "1.6.0_03"

Java (TM) SE Runtime Environment (build 1.6.0_03-b05) Java HotSpot


(TM) Server VM (build 1.6.0_03-b05, mixed mode)

(If you see this happiness you already have everything you need installed)


First program (Java Hello World)
$ vi holaMundo.java

Type the following code: public
   
class HelloWorld {



public static void
main (String

[

]

args) {
       
System . out.println ( "Hello, World!" ) ; }} Save and close the file. holaMundo.java compile and run the program by typing two commands:
holaMundo.java $ javac $ java HelloWorld out: Hello, World!



0 comments:

Post a Comment