Unable to set Java Path in system variables (Windows 10) - java

I've tried adding JAVA_HOME with the directory - C:\Program Files\Java\jdk1.8.0_121 to my system variables, and then adding %JAVA_HOME%/bin to Path variable and this didn't work and I receive
'java' is not recognized as an internal or external command, operable
program or batch file.
So I've tried adding C:\Program Files\Java\jdk1.8.0_121; directly to the path variable but I still get the above error. Does anyone have any suggestions please?
Thanks
PS - The image shows me in the command prompt at C:\Program Files\Java\jdk1.8.0_121 trying 'java -version' - I just moved up one dir to test the variable, entering 'java -version' in the bin directory returns the correct info, as you would expect.

Did you try closing that command prompt and reopening it?

In the command line, run the following:
set PATH=%PATH%:C:\Program Files\Java\jdk1.8.0_121\bin
Without exiting the shell, run your java commands
E.g.
java -version
This will surely work.

Related

java -cp/javac doesn't work in cmd prompt

I am trying to run mo program by cmd :
first i try to compile my Main.java by "javac Main.java", after that i have no msg in cmd
second i run "java -cp Main"(Main.class with byte code), after that i have no output in cmd
I tryed reinstall my JDK, but it doesn't help. also when i run "java -version" in cmd i have no output. and no msg.I has set my JAVA_HOME path into JDK dir and set him into my PATH "%JAVA_HOME\bin". what i cant do wrong? Pls help
Your path environment variable for java is not set correctly. You could try to run the command where java and most likely it will return a path that is not correct (or nothing).
Find the correct path where your JDK is installed and run this command to add it to the path vars in cmd:
set PATH=%PATH%;C:\your\path\here\
An example for my system and path would be:
set PATH=%PATH%;C:\Program Files\Java\jdk-11\bin
After setting this path variable, close and reopen your cmd window and try running java -version again.
If it still doesn't show anything then you have to manually change your path variables and remove the old path.
Make sure that you have correctly set the path to the directory in which you have your java installed. For instance mine is settled in D:\Program files\java\jdk-11.0.2
Subsequently I set JAVA_HOME as
Then you open path variable and new entry as following:
Then save all changes. Close all running cmd, start it again and then retry java -version

Run jps on command promt

I installed Hadoop and tried to run it. The terminal shows that everything has been started but when I run jps command it shows :
'jps' is not recognized as an internal or external command,
operable program or batch file.
I set JAVA_HOME= C:\Progra~1\Java\jre1.8.0_261 and path = C:\Progra~1\Java\jre1.8.0_261\bin and C:\Program~1\Java\jre1.8.0_261\legal\jdk in enviroment, but when I type jps in command prompt it shows : Not recognized as an internal or external command.
I don't know what can I do, Help me, please.
It looks like the jps executable is no present in the bin directory that you've specified in system environment variable. It should be inside C:\Program Files\Java\jdk1.8.0_261\bin if you have jdk1.8.0_26 installed in your system in the location C:\Program Files. Try specifying the JAVA_HOME like this:
Go to Control Panel -> System -> Advanced System Settings -> Environment Variables.
Add a new path variable called JAVA_HOME:
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_261
Select Path from System Variables and click Edit.
Remove the existing Java path and add the new path as %JAVA_HOME%\bin
Now, open command window, type jps and hit ENTER.
Note: You can download JDK from here

Java and javac not working in cmd. Both java and javac "is not recognized as an internal.."

I am having som trouble with java, i have tried to fix my Path, but i am new to programming and don`t know what to do.
I have java installed at : C:\Program Files\Java\jdk1.8.0_92\bin
and at : C:\Program Files (x86)\Java\jdk1.8.0_91\bin
Here are some screenshots from my system variables: This pops up when i click on the system variable "Path", see the other picture.
System variables
When I am in cmd, and writing java -version or javac -version, I get this message:
"java/javac is not recognized as an internal or external command, operable program or batch file".
Have tried to restart cmd every time i have changed the path.
Try Setting separate variables for JDK & JRE
Also give a backslash "\" after bin in the case of both JDK & JRE
Hope this works
First go to this path to make sure that it is right.
second try to restart your cmd and try again.

Having trouble running javac from command line

I am trying to compile java files using either the command prompt or Git-Bash (running Windows 7) but I am having no luck. I've researched this and followed the simple steps of checking the version of Java I have by running:
java -version
from the command line and I get "1.8.0_102".
So I went to my PATH variable and appended:
;C:\Program Files\Java\jdk1.8.0_102\bin
I have checked what seems like a thousand times and this is the proper directory, but when I run
javac
from the command line, I still get the error
'javac' is not recognized as an internal or external command, operable program or batch file.
Can anyone huide me in the right direction?
Try to set
JAVA_HOME system variable to C:\Progam Files\Java\jdk1.8.0_102;
and add %JAVA_HOME%\bin; to your CLASSPATH variable
Then restart the command line and try
It's official, dumbest mistake I've made yet. I wrote
Progam Files
not
Program Files

Javac Command Not Working

My javac command is not working.
"javac is not recognized as an internal or external command, operable program or batch file."
-java version WORKS
I've tried setting classpath successfully in command prompt. SET CLASSPATH "C:\Program Files\Java\jdk1.7.0_09\bin";
Ive adding it in environment variables. ;C:\Program Files\Java\jdk1.7.0_09\bin ;C:\Program Files\Java\jre7\bin
Ive checked the bin folder java.exe is there aswell as javac.exe.
^ Tried all of these still doesn't work. I've also restarted command prompt still does not not work.
Why is not working?
You're using the correct path apparently, but you should assign it to the PATH variable, not to the CLASSPATH variable.
You're trying to set the access path to the executable files, not to the class files.
Just do this
In the same dialog, make sure that JAVA_HOME exists in your user variables or in the system variables and it is set to the location of your JDK,
e.g. C:\Program Files\Java\jdk1.5.0_02 and that %JAVA_HOME%\bin is in your Path environment variable.
Just set JAVA_HOME to
C:\Program Files\Java\jdk1.7.0_09
After adding the path to the jre7\bin-Folder to the PATH-Variable, you need to restart your Computer in most cases.
Did you tried to create a JAVA_HOME variable? The value should be the path of the java without the bin.
Also, try to open Eclipse.
If nothing helps, the last thing that you can do is install netbeans, it will configurate everything.

Categories

Resources