This is an automated email from the ASF dual-hosted git repository.
mbien pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git
The following commit(s) were added to refs/heads/master by this push:
new 86756a9601 use java.home if jdk.home leads to symlinks.
new c9fd363ddc Merge pull request #4390 from mbien/validate-jdk-home
86756a9601 is described below
commit 86756a96016a269e15ee79ff369dd5f41e3b6c87
Author: Michael Bien <[email protected]>
AuthorDate: Sat Jul 16 12:20:39 2022 +0200
use java.home if jdk.home leads to symlinks.
- /usr shouldn't be a valid path for the default JDK
- use java.home if jdk.home/bin/java is a symlink
- updated some related warning messages
- fixes #4365
---
.../src/org/netbeans/api/debugger/jpda/Bundle.properties | 4 +---
java/form/src/org/netbeans/modules/form/Bundle2.properties | 4 +---
.../j2seplatform/platformdefinition/DefaultPlatformImpl.java | 11 +++++------
3 files changed, 7 insertions(+), 12 deletions(-)
diff --git
a/java/api.debugger.jpda/src/org/netbeans/api/debugger/jpda/Bundle.properties
b/java/api.debugger.jpda/src/org/netbeans/api/debugger/jpda/Bundle.properties
index 200ae65f71..0b9880d516 100644
---
a/java/api.debugger.jpda/src/org/netbeans/api/debugger/jpda/Bundle.properties
+++
b/java/api.debugger.jpda/src/org/netbeans/api/debugger/jpda/Bundle.properties
@@ -22,9 +22,7 @@ OpenIDE-Module-Short-Description=JPDA Debugger API
OpenIDE-Module-Long-Description=JPDA Debugger API
OpenIDE-Module-Package-Dependency-Message=\
<b>The JDK is missing and is required to run some NetBeans modules</b><br>
\
- Please use the --jdkhome command line option to specify a JDK<br>\
- installation or see <a
href="http://wiki.netbeans.org/FaqRunningOnJre">http://wiki.netbeans.org/FaqRunningOnJre</a>
for<br> \
- more information.
+ Please use the --jdkhome command line option or set netbeans_jdkhome in
your netbeans.conf to specify a JDK.
MSG_NO_DEBUGGER=No debugger engine available.
ClassBrkp_Type=Class Load/Unload
diff --git a/java/form/src/org/netbeans/modules/form/Bundle2.properties
b/java/form/src/org/netbeans/modules/form/Bundle2.properties
index 07d01b54c4..0d5aa5018d 100644
--- a/java/form/src/org/netbeans/modules/form/Bundle2.properties
+++ b/java/form/src/org/netbeans/modules/form/Bundle2.properties
@@ -22,6 +22,4 @@ OpenIDE-Module-Long-Description=The Form Editor module
enables you to visually d
OpenIDE-Module-Display-Category=Java
OpenIDE-Module-Package-Dependency-Message=\
<b>The JDK is missing and is required to run some NetBeans modules</b><br>
\
- Please use the --jdkhome command line option to specify a JDK<br>\
- installation or see <a
href="http://wiki.netbeans.org/FaqRunningOnJre">http://wiki.netbeans.org/FaqRunningOnJre</a>
for<br> \
- more information.
+ Please use the --jdkhome command line option or set netbeans_jdkhome in
your netbeans.conf to specify a JDK.
diff --git
a/java/java.j2seplatform/src/org/netbeans/modules/java/j2seplatform/platformdefinition/DefaultPlatformImpl.java
b/java/java.j2seplatform/src/org/netbeans/modules/java/j2seplatform/platformdefinition/DefaultPlatformImpl.java
index d19433da9f..687a720ee5 100644
---
a/java/java.j2seplatform/src/org/netbeans/modules/java/j2seplatform/platformdefinition/DefaultPlatformImpl.java
+++
b/java/java.j2seplatform/src/org/netbeans/modules/java/j2seplatform/platformdefinition/DefaultPlatformImpl.java
@@ -23,13 +23,13 @@ import java.io.*;
import java.net.URL;
import java.util.*;
import java.net.MalformedURLException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
import org.openide.util.Exceptions;
-
import org.openide.util.NbBundle;
import org.openide.util.Utilities;
import org.openide.filesystems.FileUtil;
import org.netbeans.api.java.platform.*;
-import org.netbeans.api.java.classpath.*;
/**
* Implementation of the "Default" platform. The information here is extracted
@@ -42,8 +42,6 @@ public class DefaultPlatformImpl extends J2SEPlatformImpl {
public static final String DEFAULT_PLATFORM_ANT_NAME = "default_platform";
//NOI18N
- private ClassPath standardLibs;
-
@SuppressWarnings("unchecked") //Properties cast to Map<String,String>
static JavaPlatform create(Map<String,String> properties, List<URL>
sources, List<URL> javadoc) {
if (properties == null) {
@@ -53,9 +51,9 @@ public class DefaultPlatformImpl extends J2SEPlatformImpl {
synchronized (p) {
p = new HashMap<>(p);
}
- String jdkHome = System.getProperty("jdk.home"); // NOI18N
+ String jdkHome = System.getProperty("jdk.home"); // NOI18N
File javaHome;
- if (jdkHome == null) {
+ if (jdkHome == null || Files.isSymbolicLink(Paths.get(jdkHome, "bin",
"java"))) {
if (Util.getSpecificationVersion((String)
p.get("java.specification.version")).compareTo(Util.JDK9) < 0) {
javaHome = FileUtil.normalizeFile(new
File(System.getProperty("java.home")).getParentFile()); // NOI18N
} else {
@@ -64,6 +62,7 @@ public class DefaultPlatformImpl extends J2SEPlatformImpl {
} else {
javaHome = FileUtil.normalizeFile(new File(jdkHome));
}
+
List<URL> installFolders = new ArrayList<> ();
try {
installFolders.add (Utilities.toURI(javaHome).toURL());
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists