0

I am having issues running java from the command prompt. I believe it may be something to do with setting up the environment variables. I am using windows 10.

I have a simple java code that prints the word "yes"

when I try the following this happens:

> javac test.java
>
>java test
>

whereas when I try:

> "C:\Program Files\Java\jdk-13.0.2\bin\javac.exe" test.java
>
> "C:\Program Files\Java\jdk-13.0.2\bin\java" test
> yes

It works

my path and java home look as follows:

>echo %JAVA_HOME%
>C:\Program Files\Java\jdk-13.0.2
>echo %PATH%
>C:\Program Files\Common Files\Oracle\Java\javapath;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\Java\jdk-13.0.2\bin;C:\Program Files\Java\jdk-13.0.2\bin;C:\Users\name\AppData\Local\Microsoft\WindowsApps;

Any help would be appreciated :) thank you

3
  • 1
    What's in C:\Program Files\Common Files\Oracle\Java\javapath? Commented Feb 14, 2021 at 19:44
  • @akuzminykh java, javac, javaw, jshell. I also have a Program Files (x86) directory if this helps Commented Feb 14, 2021 at 20:08
  • 1
    Move C:\Program Files\Java\jdk-13.0.2\bin; right at the beginning in PATH. Commented Feb 14, 2021 at 20:08

1 Answer 1

1

Try removing below entry to use manual jdk path only.

C:\Program Files\Common Files\Oracle\Java\javapath

refer How to best set the path to java in windows

not sure which installation you've but you can find more info here

https://support.oracle.com/knowledge/Middleware/2412304_1.html

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.