Our social:

Sunday

Compile & Run Java With CMD


Long before IDEs programmers use to write Java codes with simple text editors like Notepad(Windows) and then compile and run them using the Command Prompt. But hey there are
lots of IDEs around that does all the dirty work for you so why bother about this post right? Well no knowledge is waste don't know when it'll come in handy. This post aims at setting up your computer for Java programming with CMD

To test the Java Compiler

1. Open Command Prompt

2. Type "javac" and then press enter

3. If you see an error message that says "javac is not recognized as an internal or external command. operable program or batch file." proceed to 4. otherwise you are at Step 9 under Setting Up Environment Variables

4. Open your computer and click on the Local disk (C:) or your main hard drive

5. Open Program Files(x86) > Java > jdk1.7.0_40 > bin

6. Right-click on any file and then click Properties

7. Select and copy the location directory C:\Program Files (x86)\Java\jdk1.7.0_40\bin

Setting Up Environment Variables

1. From your start menu right-click on computer then click on properties (windows 7) or for those using windows 10 just right-click on your start menu and then click on system

2. On the left sidebar click on Advanced system settings

3. Click on Environment Variables

4. Click on New under user variables

5. Type "Path" for the Variable name and then paste the directory you copied from earlier to the variable value "C:\Program Files (x86)\Java\jdk1.7.0_40\bin"

6. Click OK and OK again

7. Open Command Prompt

8. Type "javac" and then press enter

9. It displays some useful codes meaning our compiler is set and ready to compile and run Java programs

0 comments:

Post a Comment