How To Set Up Java Programming On Windows

So I want to write java programs on Windows, besides writing codes, I have to be able to compile and test the programs, there are a few steps that need to be done before I could really do it without errors.

I needed Java SE Development Kit JDK 8, download and install. I use notepadd++ to write codes.

Now, Windows doesn’t know where javac or path of the program are, I have to set them or I’ll get all the errors. Using cmd windows and set the path. At the prompt:

set path=”C:\Program Files\Java\jdk1.8.0_20\bin”

set classpath=%classpath%;.; //don’t forget the little “.” between ;;

java bin folder     javatxt

So, I used notepad++ to create a program call HelloWorld.java in my portable drive J:\java\programs\ with the content:

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

Now I can compile the program with “javac HelloWorld.java”

Below is the screen shot of all the problems before I set the path of java and classpath.

javaprogramming errors

Now the path is set temporarily, I need to set the path and classpath permanently so I don’t have to type every time.

Right-click mycomputer –>properties–>system protection–>advanced–>Environment Variables and add PATH and CLASSPATH with the java sdk bin address with “;” 

Add PATH

Computer Properties     System Protection Advanced

Add New Variable "PATH"     PATH Variable

Add CLASSPATH

CLASSPATH Variable     PATH and CLASSPATH Variables

No more setting PATH or CLASSPATH

PATH and CLASSPATH permanent

Nice tutorial for java is here.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.