Betty Baur
Betty Baur

Reputation: 17

Issues with running java from the command prompt

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

Upvotes: 0

Views: 499

Answers (1)

Rahul Sawant
Rahul Sawant

Reputation: 1264

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

Upvotes: 1

Related Questions