Introduction: Use Notepad and Command Prompt for Java Programming

About: I like food, music, video games, and art. I enjoy learning languages, playing games, making music, drawing, and making things in general. Don't mind my weird instructables.

Hello, in this instructable, I will show you how to create, and execute a program that you created in java using notepad. You will need to open some things:

-Notepad

-Command Prompt

Step 1: Create the Program

For this step, use notepad and make your program. Don't forget to save as ".java" in all files. I typed in the "Hello World!" program to keep it simple. It goes as following:

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

Step 2: Make Into .class

Now, open Command Prompt. You can open it on Windows 8 by going into the start menu, then type, "Command Prompt" then click the program titled "Command Prompt". For older versions of windows, click the start button, then go to All Programs>Accessories>Command Prompt. Once you have it open, go to the file destination of the .java file. Then, type, "dir", it will bring up everything in the directory. Now, type, "javac ____.java". Replace the blank space with your program's name. Now, type, "java ____". Again, replace the blank with your program's name, and remember not to type, ".java" at the end this time. It should then successfully open your program.

If you get an error when typing "javac" then you have to set some things up before you can build java files.

Open File Explorer. Then go to C Drive. Then, Program Files. Then, Java. Then, jdk1.8.0_40. Then, bin. Then, click once on java. Then, click the top bar where it says "Local Disk C > Program Files > Java > jdk1.8.0_40 > bin > java. It should highlight the text. Now, copy that text. From there, Open Control Panel, then, go to System and Security. Then, go to System. Then, go to Advanced system settings. From there, click, "Environment Variables". Then, click "Path". Now, DO NOT DELETE THE HIGHLIGHTED TEXT. You need to go to the very right-most part of all the text then type ";" then paste the text you copied from

earlier onto the end. Then, click OK, then OK, then OK. You can now build your program.

Coded Creations

Participated in the
Coded Creations