Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Arthanareeswaran2017-03-16 05:37:52 +0000
committerJay Arthanareeswaran2017-03-16 07:56:04 +0000
commitf84e7124e130abc28dd92f24273a0b0bbf2efb4f (patch)
treeb737d1fbe1f54541f0526ce1af3a738f4b957f32
parenta71cd218cb27c791249c053959dc9db73269c1c7 (diff)
downloadeclipse.jdt.core-Y20170321-2315.tar.gz
eclipse.jdt.core-Y20170321-2315.tar.xz
eclipse.jdt.core-Y20170321-2315.zip
Bug 487421 - Running ECJ with JRE 8 with --system doesn't work.Y20170321-2315Y20170321-0120Y20170316-0500P20170316-0420
Change-Id: I8b299b721be5b51c5bff90abca49610ee0d42559 Signed-off-by: Jay Arthanareeswaran <jarthana@in.ibm.com>
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/JRTUtil.java31
1 files changed, 12 insertions, 19 deletions
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/JRTUtil.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/JRTUtil.java
index 4ff89f28e7..635ea4ef37 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/JRTUtil.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/util/JRTUtil.java
@@ -181,31 +181,24 @@ class JrtFileSystem {
initialize(jrt);
}
void initialize(File jrt) throws IOException {
+ URL jrtPath = null;
+ String jdkHome = null;
+ if (jrt.toString().endsWith(JRTUtil.JRT_FS_JAR)) {
+ jrtPath = jrt.toPath().toUri().toURL();
+ jdkHome = jrt.getParentFile().getParent();
+ } else {
+ jdkHome = jrt.toPath().toString();
+ jrtPath = Paths.get(jdkHome, "lib", JRTUtil.JRT_FS_JAR).toUri().toURL(); //$NON-NLS-1$
+
+ }
+ JRTUtil.MODULE_TO_LOAD = System.getProperty("modules.to.load"); //$NON-NLS-1$
String javaVersion = System.getProperty("java.version"); //$NON-NLS-1$
if (javaVersion != null && javaVersion.startsWith("1.8")) { //$NON-NLS-1$
- URL url = null;
- if (jrt.toString().endsWith(JRTUtil.JRT_FS_JAR)) {
- url = jrt.toPath().toUri().toURL();
- } else if (jrt.isDirectory()) {
- url = jrt.toPath().toUri().toURL();
- } else {
- String jdkHome = jrt.getParentFile().getParentFile().getParent();
- url = Paths.get(jdkHome, JRTUtil.JRT_FS_JAR).toUri().toURL();
- }
JRTUtil.MODULE_TO_LOAD = System.getProperty("modules.to.load"); //$NON-NLS-1$
- URLClassLoader loader = new URLClassLoader(new URL[] { url });
+ URLClassLoader loader = new URLClassLoader(new URL[] { jrtPath });
HashMap<String, ?> env = new HashMap<>();
this.jrtSystem = FileSystems.newFileSystem(JRTUtil.JRT_URI, env, loader);
} else {
- String jdkHome = null;
- if (jrt.toString().endsWith(JRTUtil.JRT_FS_JAR)) {
- jdkHome = jrt.getParentFile().getParent();
- } else if (jrt.isDirectory()) {
- jdkHome = jrt.toPath().toString();
- } else {
- return;
- }
- JRTUtil.MODULE_TO_LOAD = System.getProperty("modules.to.load"); //$NON-NLS-1$
HashMap<String, String> env = new HashMap<>();
env.put("java.home", jdkHome); //$NON-NLS-1$
this.jrtSystem = FileSystems.newFileSystem(JRTUtil.JRT_URI, env);

Back to the top