Main Menu

friends

Banner

Latest articles

very simple folder encryption with ecryptfs
27/09/2009 | mad mad mod

Sometimes you want to protect some of your files from unauthorized access. One option is use a cryptographic filesystem like ecryptfs. "eCryptfs is a POSIX-compliant enterprise-class stacked cryptogra [ ... ]


Firewall on Fedora Linux
18/04/2009 | mad mad mod

In a nutshell
The core of the Linux firewall is the netfilter kernel module. To add or remove firewall rules you need the "iptables" application (should already be installed).  where is the  [ ... ]


Other Articles
Facebook MySpace Twitter Digg Delicious Stumbleupon Google Bookmarks 

Designed by:
SiteGround web hosting Joomla Templates
Hello World in java E-mail
programming

This article describes how to write, compile and execute a "Hello World" program in java on Linux (Fedora).

 

1. the prerequisites

 

2. write the code


open an empty file with a text editor (e.g. vi):


# vi HelloWorld.java



now write the following code into the sourcefile:

public class HelloWorld {
public static void main( String args[] ) {
System.out.println( "Hello World!" );
}
}



save the file and exit vi with ":wq + enter"

 

important: the source file must have the same name as the public class (HelloWorld.java)

 

explanation


public class HelloWorld {

}

our "main" class is called HelloWorld. public indicates that the class can be used by any program or user.

 

public static void main( String args[] ) {

}

The main method ist where the execution of the class starts. void indicates that the method does not return any value.

 


System.out.println( "Hello World!" );

This prints out the string "Hello World!"

 

 

3. compile into bytecode



# javac HelloWorld.java




This produces an file called "HelloWorld.class".



4. run the program


you can now execute the bytecode with:


# java HelloWorld
Hello World!

 

 

 

Comments (0)
Write comment
Your Contact Details:
Comment:
[b] [i] [u] [url] [quote] [code] [img]   
:D:angry::angry-red::evil::idea::love::x:no-comments::ooo::pirate::?::(
:sleep::););)):0
Security
Please input the anti-spam code that you can read in the image.

!joomlacomment 4.0 Copyright (C) 2009 Compojoom.com . All rights reserved."

 
mad mad mod, Powered by Joomla! and designed by SiteGround web hosting