Although many Java developers compile Java programs within IDE it is also essential skill for them to learn how to compile directly from windows shell. In this tutorial I will show you how to install Java SDK and compile your code from within Windows Command Line.
1 Star2 Stars3 Stars4 Stars5 Stars (Rate This)
Loading...

Although many Java developers compile Java programs within IDE it is also essential skill for them to learn how to compile directly from windows shell. In this tutorial I will show you how to install Java SDK and compile your code from within Windows Command Line.


To get started follow steps below:

Step 1: The first thing you need to do is download JDK from Oracle website in order to have the latest version of Java installed on your computer.

Step 2: Once download is completed lunch the installation and follow on-screen instruction. One important thing you need to pay attention to is the location where you have installed JDK, so make sure you write it down somewhere.

Step 3: Now we need to create a main directory where we will be holding all Java files. For example, you can create a folder at c:\java and place .java files and project within that folder.

Step 4: Now click Start menu, type system in search box and press Enter on your keyboard.

Step 5: From window that appears, inside left pane select Advanced system settings.

Step 6: A new window will open with Advanced tab selected. At the bottom of that window click on Environment Variables… button.

Step 7: Under System variables section scroll down to the variable Path and select it.

Step 8: Now click on Edit button.

Step 9: Now you need to include a path which you have remembered from Step 2 and type it at the end of Variable value field. Make sure you close it with ;. So in my case that path will be C:\Program Files\Java\jdk1.7.0_07\;

Note: If you add a wrong path in here you will get following error when you try to compile: ‘javac’ is not recognized as an internal or external command, operable program or batch file.

Step 10: Click OK three times to save all changes.

Step 11: Now click Start menu, type cmd inside search field and press Enter on your keyboard.

Step 12: Now type cd \java which is the path of folder we created in Step 3.

Step 13: Type javac NewJavaFileName.java where NewJavaFileName.java represent a file name which you want to compile. Press Enter to start compilation.

Step 14: Now go back to your personal Java folder and you should see a new .class file.

There you go. Now you know how to compile Java from Windows Command Prompt.

Buy Cheapest Related Product From Amazon.com


Amazon Is Taking Pre-Order For 3M Streaming Projector By Roku For $300

Virgin Galactic Now Owns The SpaceShip Company 100%
You can also press the left/right arrow key on your keyboard to go to previous/next post
  On October 7, 2012(3 years, 11 months ago.)

You May Also Like:

What Do You Think?

Leave a Reply




Loading Facebook Comments ...

FTC Disclosure: Some of the links of this website are "affiliate links." This means if you click on the link and purchase the item, we will receive an affiliate commission.


Recent Search

Recent Tutorials

There is a high-risk XSS Vulnerability in W3 Total Cache, and we have got the guide to the fix for you.
Check out this tutorial to know how to install Apple watchOS 3 beta certificate on your Apple Watch and start enjoying the new version.
If you are trying to jailbreak iPhone, iPad or iPod on iOS 9.2 - 9.3.3 without using a computer or Apple ID, then check this video tutorial.
Pokemon Go users are complaining about the crashing and server issues. Check out the tutorial to solve error problems and thanks us later.
Turning off Wi-Fi Assist is a great way to save mobile data since it automatically starts using cellular data when Wi-Fi signal is poor .
If you want to secure your SIM card from others using it, then check out this tutorial to know how to set up the SIM Pin code on your iPhone.
CiderTV is a great alternative to control Apple TV from the Notification Center. Check out this tutorial to set up CiderTV on your iPhone.
Are you annoyed by the split screen mode on the iPhone 6 Plus or 6s Plus? Check out this quick tutorial to turn off split screen feature.
If you could not wait to installed the iOS 10 beta version on you iPhone and now struggling for the errors, then this tutorial is for you.
Siri might not understand the question you asked. But you can use Siri by editing the text that you asked & it will give an updated answer.

TTJ Deals

Close You Have To Login
User:
Pass:
Login With »Login With TwitterLogin With Facebook