eclipse-jdt / eclipse.jdt.debug

Eclipse Public License 2.0
16 stars 46 forks source link

Detect Windows JVMs on startup #369

Open Bananeweizen opened 8 months ago

Bananeweizen commented 8 months ago

What it does

The JDK detection mechanism doesn't find much on Windows. Have it find the default installation directories of Adoptium and RedHat, both in the 64 and 32 bit installation directories. Further JDK distributors can easily be added without changing the code logic.

Also let duplicate VM names start with index 2, not 1. And finally improve the job name.

On my machine that change adds the upper 4 entries of this screenshot: grafik

How to test

Install Adoptium or Redhat OpenJDK in default location and check preference page.

Author checklist

jukzi commented 6 months ago

I tested the PR and it works. Manually i found also JDKs installed in C:\Program Files\Eclipse Foundation\jdk-11.0.12.7-hotspot C:\Program Files\Java\jdk1.8.0_202 which have not been found. i don't know if that are standard paths some how, but i can not remember to have selected them manually.

I would be good to search also in the system "PATH"s, where the commandline would also find the "java" command.

It might be nice to have an information logged like ILog.get().info("Detected installed JVM: " + name); //$NON-NLS-1$

What do you think?

jukzi commented 6 months ago

@merks how does OOmph detect JVMs?

merks commented 6 months ago

We do similar adhoc things:

https://github.com/eclipse-oomph/oomph/blob/master/plugins/org.eclipse.oomph.jreinfo/src/org/eclipse/oomph/jreinfo/JREInfo.java

Also some native stuff to look in the system registry:

https://github.com/eclipse-oomph/oomph/blob/master/plugins/org.eclipse.oomph.jreinfo.lib/src/jreinfo.c

I think there are other more modern ways in which one could look in the system registry. Even here you know to know for which keys to search.

Oomph as an advantage that it stores information globally for reuse across installations and workspaces...

jukzi commented 6 months ago

@Bananeweizen oracles JDK installs to programm files\java\ by default image please add that and then this PR is good to go.