comparison graal/com.oracle.graal.hotspot.loader/src/com/oracle/graal/hotspot/loader/Factory.java @ 16623:addc0564e5b5

split com.oracle.graal.truffle.* projects into a separate graal-truffle.jar and added truffle.jar to the boot class path
author Doug Simon <doug.simon@oracle.com>
date Wed, 30 Jul 2014 18:27:06 +0200
parents 8eec87d7bfc4
children 74123ce7599b
comparison
equal deleted inserted replaced
16622:faaea970b951 16623:addc0564e5b5
24 24
25 import java.io.*; 25 import java.io.*;
26 import java.net.*; 26 import java.net.*;
27 27
28 /** 28 /**
29 * Utility to create a separate class loader for loading classes in {@code graal.jar}. 29 * Utility to create a separate class loader for loading classes in {@code graal.jar} and
30 * {@code graal-truffle.jar}.
30 */ 31 */
31 public class Factory { 32 public class Factory {
32 33
33 /** 34 /**
34 * Creates a new class loader for loading classes in {@code graal.jar}. 35 * Creates a new class loader for loading classes in {@code graal.jar} and
36 * {@code graal-truffle.jar}
35 * 37 *
36 * Called from the VM. 38 * Called from the VM.
37 */ 39 */
38 @SuppressWarnings("unused") 40 @SuppressWarnings("unused")
39 private static ClassLoader newClassLoader() throws MalformedURLException { 41 private static ClassLoader newClassLoader() throws MalformedURLException {
40 URL[] urls = {getGraalJarUrl()}; 42 URL[] urls = {getGraalJarUrl("graal"), getGraalJarUrl("graal-truffle")};
41 return URLClassLoader.newInstance(urls); 43 return URLClassLoader.newInstance(urls);
42 } 44 }
43 45
44 /** 46 /**
45 * Gets the URL for {@code graal.jar}. 47 * Gets the URL for {@code base.jar}.
46 */ 48 */
47 private static URL getGraalJarUrl() throws MalformedURLException { 49 private static URL getGraalJarUrl(String base) throws MalformedURLException {
48 File file = new File(System.getProperty("java.home")); 50 File file = new File(System.getProperty("java.home"));
49 for (String name : new String[]{"lib", "graal.jar"}) { 51 for (String name : new String[]{"lib", base + ".jar"}) {
50 file = new File(file, name); 52 file = new File(file, name);
51 } 53 }
52 54
53 if (!file.exists()) { 55 if (!file.exists()) {
54 throw new InternalError(file + " does not exist"); 56 throw new InternalError(file + " does not exist");