version-fox / vfox

A cross-platform and extendable version manager with support for Java, Node.js, Flutter, .Net & more
https://vfox.lhan.me
Apache License 2.0
2.73k stars 99 forks source link

[Feature]: Symlink of `current` of Java should be `JAVA_HOME` #321

Open koppor opened 2 months ago

koppor commented 2 months ago

1. Your usage scenarios?

I want to point my Java IDE (IntelliJ) to a specific JAVA_HOME directory.

´C:\Users\koppor.version-fox\cache\java\currentis a very good directory for that. However, the symlink points to the sub directorybinof the current JDK (´C:\Users\koppor.version-fox\cache\java\currentpoints toC:\Users\koppor.version-fox\cache\java\v-21.0.2+13\java-21.0.2+13\bin` in my example)

2. What is your expected outcome?

  1. ´C:\Users\koppor.version-fox\cache\java\currentpoints toC:\Users\koppor.version-fox\cache\java\v-21.0.2+13\java-21.0.2+13`
  2. The PATH has C:\Users\koppor\.version-fox\cache\java\v-21.0.2+13\java-21.0.2+13\bin (instead of without bin

This way, one can point the IDE to the path ...current... without worrying the IDE not re-evaluating JAVA_HOME environment variable when switching JDKs.

koppor commented 2 months ago

Update: Solved by updating vfox on Windows from 0.5.2 to 0.5.4

I think, that could also solve the issue Error: could not find java.dll

C:\Users\koppor\.version-fox\cache\java\v-21.0.2+13\java-21.0.2+13\bin>java.exe
Usage: java [options] <mainclass> [args...]
           (to execute a class)
   or  java [options] -jar <jarfile> [args...]
...
C:\Users\koppor\.version-fox\temp\1719957600-73328\java\current>java
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment.

C:\Users\koppor\.version-fox\temp\1719957600-73328\java\current>cd C:\Users\koppor\.version-fox\cache\java\current

C:\Users\koppor\.version-fox\cache\java\current>java
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment.
koppor commented 2 months ago