Added JCE to classpaths for builds
This commit is contained in:
parent
39315c2163
commit
63f8b58839
|
@ -23,24 +23,49 @@ class Build {
|
|||
|
||||
|
||||
static {
|
||||
|
||||
Class<?>[] parameters = new Class[] {URL.class};
|
||||
Class<URLClassLoader> sysclass = URLClassLoader.class;
|
||||
URLClassLoader sysloader = (URLClassLoader) ClassLoader.getSystemClassLoader();
|
||||
|
||||
Method method = null;
|
||||
try {
|
||||
// we have to add javaFX to the classpath (they are not included on the classpath by default), otherwise we
|
||||
// can't compile javaFX binaries. This was fixed in Java 1.8.
|
||||
if (OS.javaVersion == 7) {
|
||||
method = sysclass.getDeclaredMethod("addURL", parameters);
|
||||
method.setAccessible(true);
|
||||
} catch (Exception e) {
|
||||
System.err.println("CRITICAL:: Can't load reflection needed to add URLS to the classpath");
|
||||
}
|
||||
|
||||
Class<?>[] parameters = new Class[] {URL.class};
|
||||
Class<URLClassLoader> sysclass = URLClassLoader.class;
|
||||
URLClassLoader sysloader = (URLClassLoader) ClassLoader.getSystemClassLoader();
|
||||
|
||||
Method method = sysclass.getDeclaredMethod("addURL", parameters);
|
||||
method.setAccessible(true);
|
||||
|
||||
File javaFxLib = new File(System.getProperty("java.home") + File.separator + "lib" + File.separator + "jfxrt.jar");
|
||||
method.invoke(sysloader, new Object[] {javaFxLib.toURI().toURL()});
|
||||
//System.err.println("adding url " + javaFxLib.getAbsolutePath());
|
||||
if (method != null) {
|
||||
// have to try to load the JCE to the classpath (it is not always included)
|
||||
// can't compile binaries that use the JCE otherwise.
|
||||
boolean jceLoaded = false;
|
||||
try {
|
||||
jceLoaded = Class.forName("javax.crypto.Mac") != null;
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
|
||||
if (!jceLoaded) {
|
||||
try {
|
||||
File jceLib = new File(System.getProperty("java.home") + File.separator + "lib" + File.separator + "jce.jar");
|
||||
method.invoke(sysloader, new Object[] {jceLib.toURI().toURL()});
|
||||
//System.err.println("adding url " + jceLib.getAbsolutePath());
|
||||
} catch (Exception ignored) {
|
||||
System.err.println("CRITICAL:: Can't load JCE to the classpath URLS");
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
// we have to add javaFX to the classpath (it is not included on the classpath by default), otherwise we
|
||||
// can't compile javaFX binaries. This was fixed in Java 1.8.
|
||||
if (OS.javaVersion == 7) {
|
||||
File javaFxLib = new File(System.getProperty("java.home") + File.separator + "lib" + File.separator + "jfxrt.jar");
|
||||
method.invoke(sysloader, new Object[] {javaFxLib.toURI().toURL()});
|
||||
//System.err.println("adding url " + javaFxLib.getAbsolutePath());
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
System.err.println("CRITICAL:: Can't load javaFX to the classpath URLS");
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
System.err.println("CRITICAL:: Can't load javaFX to the classpath URLS");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -586,11 +586,18 @@ class ProjectJava extends Project<ProjectJava> {
|
|||
args.add("-classpath");
|
||||
// System.err.println("CP " + this.classPaths.toString(File.pathSeparator));
|
||||
String cp = this.classPaths.toString(File.pathSeparator);
|
||||
String javaLibPath = System.getProperty("java.home") + File.separator + "lib" + File.separator;
|
||||
|
||||
// have to try to load the JCE to the classpath (it is not always included)
|
||||
// can't compile binaries that use the JCE otherwise.
|
||||
cp += File.pathSeparator + javaLibPath + "jce.jar";
|
||||
|
||||
if (OS.javaVersion == 7) {
|
||||
// we have to add javaFX to the classpath (they are not included on the classpath by default), otherwise we
|
||||
// can't compile javaFX binaries. This was fixed in Java 1.8.
|
||||
cp += File.pathSeparator + System.getProperty("java.home") + File.separator + "lib" + File.separator + "jfxrt.jar";
|
||||
}
|
||||
|
||||
args.add(cp);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue