Skip to content

Commit 3244e33

Browse files
committed
GH-120 use bin/javac instead of tools.jar to detect JDK
1 parent 380531d commit 3244e33

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

integrations/eclipse/org.eclipse.visualvm.launcher.common/src/org/eclipse/visualvm/launcher/preferences/LocationPreferencePage.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ public LocationPreferencePage() {
6363
* restore itself.
6464
*/
6565
public void createFieldEditors() {
66+
final boolean isWindows = System.getProperty("os.name").toUpperCase().contains("WIN"); //$NON-NLS-1$ //$NON-NLS-2$
6667
FileFieldEditor ffe = new FileFieldEditor(PreferenceConstants.P_PATH,
6768
PreferencesMessages.LocationPreferencePage_1, getFieldEditorParent()) {
6869
@Override
6970
protected void refreshValidState() {
7071
super.refreshValidState();
7172
if (isValid()) {
72-
boolean isWindows = System.getProperty("os.name").toUpperCase().contains("WIN"); //$NON-NLS-1$ //$NON-NLS-2$
7373
boolean validated = isWindows ? getStringValue().endsWith("visualvm.exe") : getStringValue().endsWith("visualvm"); //$NON-NLS-1$ //$NON-NLS-2$
7474
if (!validated) {
7575
setErrorMessage(PreferencesMessages.LocationPreferencePage_6);
@@ -90,9 +90,10 @@ PreferencesMessages.LocationPreferencePage_2, getFieldEditorParent()) {
9090
protected void refreshValidState() {
9191
super.refreshValidState();
9292
if (isValid()) {
93-
String toolsJarPath = getStringValue() + File.separator + "lib" + File.separator + "tools.jar";
94-
File toolsJarFile = new File(toolsJarPath);
95-
boolean validated = toolsJarFile.exists() && toolsJarFile.isFile();
93+
String javacPath = getStringValue() + File.separator + "bin" + File.separator +
94+
(isWindows ? "javac.exe" : "javac");
95+
File javacFile = new File(javacPath);
96+
boolean validated = javacFile.exists() && javacFile.isFile();
9697
if (!validated) {
9798
setErrorMessage(PreferencesMessages.LocationPreferencePage_7);
9899
}

0 commit comments

Comments
 (0)