Contact Our Development Team
Free Code Tutorials & Open Source Code
Introduction To Java
Tutorials > Java
Java Beginner's Guide
Welcome to the openzu.com JAVA tutorial. These tutorials are desgined to give you a basic understanding of the way in which Java works and will hopefully get you writing your own programs in no time! Please check you have met the basic requirements below before going any further.
  • You have installed the latest version of Java's JDK (Java Development Kit) from Sun's website. If not you can visit the website by clicking here. The download is free of charge and has a binary install for most operating systems
  • You have a basic understanding of command prompts / terminals for your operating system
  • You have set the "classpath" of the javac program. In windows add this to your environment variables (PATH - ;/install/location/;)
If you are unable to complete these tasks above, it might be worth asking a friend for help, or searching on the internet further!
What is Java?
Java was developed by Sun Micro Systems and is widly used throughout world. It is taught at most good Universities around the world. Java is not compiled to machine code like most other programming languages (although there are ways to achive this), instead it runs on JVM (Java Virtual Machine) which provided the operating supports it makes your code cross platform.
Your first Java program
Here's an example of a very simple HTML page.
public class HelloWorld{
	public static void main(String[] args){
		System.out.println("Hello World!");
	}
}
Hello World!
How do I make this run?
To make this simple program run on your computer, just follow these steps below. Please make sure all the steps at the beginning of this tutorial have been completed before hand.
  • Copy the code snipped into a text editor of your choice
  • Save the file as "HelloWorld.java" - The class name and file name should be the same in Java otherwise it will not compile
  • Open up a command prompt / terminal window and type "javac HelloWorld.java" to compile. Then "java HelloWorld" to run the program!
Page Responses
Currently there have been no responses to this page...
If you have anything to contribute to this tutorial, found a bug, or know a better way of achieving the same goal, please leave your response below.
     
Copyright ©2009, Wired IDS Ltd. | Licensed under Creative Commons Attribution Share-Alike | Load time: 0.3063 seconds