Home > programming > Starting Java Programming

Starting Java Programming

Java is an object oriented programming language.  It’s developed by James Gosling at Sun Microsystem in 1995. Java is a language derived from C++, so its instruction is similar to C++. Java sourcecode is compiled to bytecode (.class file). This bytecode can run in any computer architecture, as it’s slogan, “write once run anywhere” .

What to do?

1. Install JDK (Java Development Kit)

Download JDK at http://java.sun.com/javase/downloads/index.jsp. After downloading, install it by double clicking its installer. After it is installed, copy its bin address to Environtment of your computer. Right click My Computer -> Properties -> Advanced -> Environtment variable, look for the variable path , edit it, add the directories of your java.exe file (in bin folder) to it.

Now you can write javac and java to your command prompt  windows.

2. Start Programming

Open your text editor, I usually used notepad++, because it support many languages. If you use notepad++, change the language into Java. Try to write down this things..

public class HelloWorld{
                  public static void main(String[] args){
                                System.out.println(“Hello world….”);

Save this as HelloWorld.java

3. Compile it

Open command prompt. Change the directory to the directory you save HelloWorld.java.

>javac   HelloWorld.java

If you want to compile from other directory

>javac   (directory)/HelloWorld.java

After compiling, a .class file will be made. This .class file can run in any platform with JVM (Java Virtual Machine). JVM automatically installed when you install JDK.

4. Run your program

Write in your command prompt

>java   HelloWorld

Write the file name without the extension.. Then… you’ll see your text..

OK, that’s enough for today….

Categories: programming Tags: , ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: