Change java symlink

2020-06-25 04:34发布

My Windows 8 command prompt doesn't see java anymore. I found that in C:\ProgramData\Oracle\Java\javapath located wrong symlink that I can't change. When I try change I got error:

Problem with Shortcut

The name 'C:\Program Files\Java\jre1.8.0_45\bin\javaw.exe' specified in the Target box is not valid. Make sure the path and file name are correct.

When I try to create shortcut I have message:

Windows can't create a shortcut here.
Do you want the shortcut to be placed on the desktop instead?
[Yes] [No]

How to solve this problem?

3条回答
▲ chillily
2楼-- · 2020-06-25 04:54

First Uninstall the java from your system, after remove the oracle folder in C:\ProgramData. Then again reinstall the java. Next click on javac.bat in bin folder of jdk.After check with command prompt like, >javac it will display all the options.then it's working perfectly...

I think it's duplicate of

How to make a symlink in Java when running in Linux?

查看更多
The star\"
3楼-- · 2020-06-25 05:04

If you use java from the command prompt chances are high that you need to have correct JAVA_HOME variable set as well. Some tools depend on it.

To do it - edit the system environment variables:

  1. Add JAVA_HOME and point it to the install path of java version you want you could also use symbolic link for the folder
  2. In "Path" variable find "C:\ProgramData\Oracle\Java\javapath;" and replace it with %JAVA_HOME%\bin
查看更多
一夜七次
4楼-- · 2020-06-25 05:07

Here is how you solve this problem :

  • Delete the original symlinks. All the three of them, I think there are three.
  • Do not create a shortcut. Shortcut and Symlinks are not same.
  • Open a command prompt in the same directory and create new Symlinks using the "mklink" command and point it to your JDK install.
查看更多
登录 后发表回答