One of the most basic steps to work with java is to set your path variable so that you can compile and run your java related commands from the location where your java programs reside and not from the bin directory of JDK.
You might get this error in case the path is not set in environment variables:
‘javac’ is not recognized as an internal or external command, operable program or batch file
Follow the below step by step instructions to set the java path in windows environment variable:
- Make a note of the bin directory path of java and keep it available.
- Right click on Computer and select Properties context menu.
- Click on advanced System Settings.
- Click on Environment Variables button of System Properties Window under “Advanced” tab.
- Now in the “Environment Variables” window under “System Variables” section, scroll to see the variable by name path, select and click on edit.
- You will now be presented with a small window with variable name and value, go to the end of the variable, make sure you add one semi colon at the end of the current value in case it is not there and then paste your bin directory path, for example: as per my machine it is “C:\Program Files\Java\jdk1.8.0_91\bin” without double quotes, you need to form this based on the location java is installed in your machine and click on Ok button.
- Click on Ok buttons to close the parent windows as well.
- You are done with setting the path variable successfully, in order to verify if everything is fine, open a new command prompt, change directory to “c:\” drive using the command “cd \” without double quotes.
- Now try the javac command and you shall see the following message, which means, the variable is set properly and from now you can create your java programs in your desired location.
Finally you are all set to compile and run your java programs from your desired folder location.
Share your queries in form of comments, we would be more than happy to help
Founder of TestingTools.co, constantly shares knowledge on different test automation tools. Has experience in building proof of concepts, solutions, frameworks, platforms & implementation of test automation projects.
In pursuit of building a platform with inbuilt framework and reusable components for Oracle Cloud applications ( Oracle HCM, CX, SCM, Financials clouds, Salesforce and other cloud applications )
Major accomplishments in his career:
- Product architect and development manager for test automation platforms
- Oracle Flow Builder @ Oracle
- CloudTestr @ Suneratech
- 2 times to oracle open world
- More than 20 successful POCs ( Proof of concepts )
- 100 demos
- Designed pricing models.
- Trained more than 50 members.
- Built more than 100 re-usable functions.
Worked with tools: