How do I set or change the PATH system variable

+12 votes

'java' is not recognized as an internal or external command,
operable program or batch file.

This is the error I am getting can you please help me fix this?

Aug 28, 2018 in Java by eatcodesleeprepeat
• 4,710 points
1,424 views

3 answers to this question.

+4 votes

First make sure you have installed JDK properly and then follow these steps.

  1. Right click on My Computer
  2. Select Properties
  3. Select Advanced System Settings
  4. Select Advanced tab
  5. Select Environment Variables
  6. Select Path under System Variables
  7. Click on Edit button
  8. In Variable value editor paste this at the start of the line. Note: You have to mention the path of the version you have installed. I have installed jdk1.7.0_72 so my will be the line I add.

    C:\Program Files\Java\jdk1.7.0_72\bin;
  9. Click Ok then Ok again

  10. Restart command prompt otherwise it won't see the change to the path variable
  11. Type java -version in command prompt.
answered Aug 28, 2018 by slayer
• 29,370 points
+3 votes

First step is to copy the path

second step open system in control pannel and select advanced system settings

 

third step is in advanced tab select environment variable

fourth step is set path variable with a semi-colon and paste the path you copied.

There you are ready to go!

answered Aug 28, 2018 by bug_seeker
• 15,510 points
+2 votes

This error occurs when you haven't added the right directory to your PATH.

First find out which directory you've installed java in and try running it directly. Something like this in my case:

c:\> "c:\Program Files\java\jdk1.7.0_11\bin\java" -version

Once you've got the right version add the bin directory to the PATH environment.

answered Aug 28, 2018 by Kalgi
• 52,350 points

Related Questions In Java

0 votes
2 answers

How do I get the current date and time using Java?

If you require a time stamp in ...READ MORE

answered Aug 23, 2019 in Java by Sirajul
• 59,230 points
2,941 views
0 votes
1 answer

How do I create a Java string from the contents of a file?

If you're looking for an alternative that ...READ MORE

answered Apr 19, 2018 in Java by Rishabh
• 3,620 points
1,187 views
0 votes
2 answers

How can I get the filenames of all files in a folder which may or may not contain duplicates

List<String> results = new ArrayList<String>(); File[] files = ...READ MORE

answered Sep 12, 2018 in Java by Sushmita
• 6,920 points
1,919 views
0 votes
1 answer

How can I get the current date and time in UTC or GMT in Java?

This definitely returns UTC time: as String ...READ MORE

answered Jun 7, 2018 in Java by Rishabh
• 3,620 points
27,619 views
0 votes
2 answers

How do I get the size of a java.sql.ResultSet?

You could probably do rows-count. ResultSet rs = ...READ MORE

answered Aug 22, 2019 in Java by Sirajul
• 59,230 points
13,124 views
+2 votes
1 answer

How do I ask the Selenium-WebDriver to wait for few seconds in Java?

There are two ways to wait: explicit ...READ MORE

answered Dec 19, 2018 in Java by Daisy
• 8,140 points

edited Dec 19, 2018 by Daisy 958 views
+5 votes
4 answers

How to execute a python file with few arguments in java?

You can use Java Runtime.exec() to run python script, ...READ MORE

answered Mar 27, 2018 in Java by DragonLord999
• 8,450 points

edited Nov 7, 2018 by Omkar 81,246 views
+1 vote
1 answer

How to handle drop downs using Selenium WebDriver in Java

First, find an XPath which will return ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,500 points
8,366 views
0 votes
1 answer

What are the differences between getText() and getAttribute() functions in Selenium WebDriver?

See, both are used to retrieve something ...READ MORE

answered Apr 5, 2018 in Selenium by nsv999
• 5,500 points
17,445 views
0 votes
1 answer

Selenium JARS(Java) missing from downloadable link

Nothing to worry about here. In the ...READ MORE

answered Apr 5, 2018 in Selenium by nsv999
• 5,500 points

edited Aug 4, 2023 by Khan Sarfaraz 4,883 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP