Friday, December 10, 2004

Run a simple java program in SuSE 9.1

HOW TO RUN A SIMPLE JAVA PROGRAM IN SUSE )9.1

To display simple text message for example "Hello World!", you can follow the below mentioned steps.

First you need a java editer. If you don't have a one you can install jedit from the installation CDs. Once you are ready with that type "jedit" in your favourite shell and press enter.

>jedit

The above commad will open jedit. Now you can type-in the following lines in a new file and save it as "HelloWorld.java".

/* This is a simple Java program.
Call this file HelloWorld.java.
*/
class HelloWorld {
public static void main(String[])
{
System.out.println("Hello World");
}
}


Now goto the directory where the file is saved using cd command.

eg.: >cd /home/linux

>javac HelloWorld.java
>java HelloWorld

If you did everything correctly you would see the following line on your shell.
Hello World

Good luck!

Waruna

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home