Java 类sun.misc.Launcher 实例源码

项目:iot-lab    文件:SparkPredictionBolt.java   
private Evaluator instantiateJPMMLModel() {
  PMML pmml = null;
  try {
    pmml = IOUtil.unmarshal(Launcher.class.getResource("/predictionModel-PMML.xml").openStream());
  } catch (Exception e) {
    e.printStackTrace();
  }
  PMMLManager pmmlManager = new PMMLManager(pmml);
  Evaluator evaluator = (Evaluator) pmmlManager.getModelManager(null, ModelEvaluatorFactory.getInstance());
  return evaluator;
}
项目:Maxine-VM    文件:JavaRunScheme.java   
private void invokeMethod(String className, URL url, String methodName, String args) throws ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
    final ClassLoader appClassLoader = Launcher.getLauncher().getClassLoader();
    final Class<?> agentClass = appClassLoader.loadClass(className);
    Method method = null;
    Object[] invokeArgs = null;
    try {
        method = lookupMainOrAgentClass(agentClass, methodName, new Class<?>[] {String.class, Instrumentation.class});
        invokeArgs = new Object[2];
        invokeArgs[1] = InstrumentationManager.createInstrumentation();
    } catch (NoSuchMethodException ex) {
        method = lookupMainOrAgentClass(agentClass, methodName, new Class<?>[] {String.class});
        invokeArgs = new Object[1];
    }
    invokeArgs[0] = args;
    InstrumentationManager.registerAgent(url);
    method.invoke(null, invokeArgs);
}
项目:fdc-serializable-function    文件:Tests.java   
/**
 * see test name.
 */
@Test
public void shouldCoverAllFunctionsFromJDKPackage() throws Exception {

    final Reflections reflections = new Reflections( "java.util.function", Launcher.getBootstrapClassPath().getURLs() );
    final Set<Class<?>> jdkFunctions = reflections.getTypesAnnotatedWith( FunctionalInterface.class );

    final Set<Class<?>> serializableFunctions = serializableFunctions();

    final Set<Class<?>> notFoundJdkFunctions = new HashSet<>();
    for ( final Class<?> jdkFunction : jdkFunctions ) {
        final Class<?> correspondingSerializableFunction =
                findSerializableVariantOf( jdkFunction.getSimpleName(), serializableFunctions );
        if ( correspondingSerializableFunction == null ) {
            notFoundJdkFunctions.add( jdkFunction );
        }
    }

    assertThat( String.format( "Not covered ( %s ): %s ", notFoundJdkFunctions.size(), notFoundJdkFunctions ),
            notFoundJdkFunctions.isEmpty() );
}
项目:Maxine-VM    文件:JavaRunScheme.java   
@Override
void handle(String className, URL[] urls, String agentArgs)
    throws IOException, ClassNotFoundException, InvocationTargetException, IllegalAccessException, NoSuchMethodException {
    for (URL url : urls) {
        addURLToAppClassLoader.invoke(Launcher.getLauncher().getClassLoader(), url);
    }
    invokeMethod(className, urls[0], "premain", agentArgs);
}
项目:ApkToolPlus    文件:JarUtils.java   
public void test(String path) throws Exception {
    final File jarFile = getJarFile(null);

    if(jarFile.isFile()) {  // Run with JAR file
        final JarFile jar = new JarFile(jarFile);
        final Enumeration<JarEntry> entries = jar.entries(); //gives ALL entries in jar
        while(entries.hasMoreElements()) {
            final String name = entries.nextElement().getName();
            if (name.startsWith(path + "/")) { //filter according to the path
                System.out.println(name);
            }
        }
        jar.close();
    } else { // Run with IDE
        final URL url = Launcher.class.getResource("/" + path);
        if (url != null) {
            try {
                final File apps = new File(url.toURI());
                for (File app : apps.listFiles()) {
                    System.out.println(app);
                }
            } catch (URISyntaxException e) {
                e.printStackTrace();
            }
        }
    }
}
项目:intellij-ce-playground    文件:aClassLoader.java   
private static synchronized void initSystemClassLoader() {
if (!sclSet) {
    if (scl != null)
    throw new IllegalStateException("recursive call");
           sun.misc.Launcher l = sun.misc.Launcher.getLauncher();
    if (l != null) {
    Throwable oops = null;
    scl = l.getClassLoader();
        try {
        PrivilegedExceptionAction a;
        a = new SystemClassLoaderAction(scl);
                   scl = (ClassLoader) AccessController.doPrivileged(a);
        } catch (PrivilegedActionException pae) {
        oops = pae.getCause();
            if (oops instanceof InvocationTargetException) {
            oops = oops.getCause();
        }
        }
    if (oops != null) {
        if (oops instanceof Error) {
        throw (Error) oops;
        } else {
            // wrap the exception
            throw new Error(oops);
        }
    }
    }
    sclSet = true;
}
   }
项目:iot-masterclass    文件:SparkPredictionBolt.java   
private Evaluator instantiateJPMMLModel() {
  PMML pmml = null;
  try {
    pmml = IOUtil.unmarshal(Launcher.class.getResource("/predictionModel-PMML.xml").openStream());
  } catch (Exception e) {
    e.printStackTrace();
  }
  PMMLManager pmmlManager = new PMMLManager(pmml);
  Evaluator evaluator = (Evaluator) pmmlManager.getModelManager(null, ModelEvaluatorFactory.getInstance());
  return evaluator;
}
项目:iot-masterclass    文件:SparkPredictionBolt.java   
private Evaluator instantiateJPMMLModel() {
  PMML pmml = null;
  try {
    pmml = IOUtil.unmarshal(Launcher.class.getResource("/predictionModel-PMML.xml").openStream());
  } catch (Exception e) {
    e.printStackTrace();
  }
  PMMLManager pmmlManager = new PMMLManager(pmml);
  Evaluator evaluator = (Evaluator) pmmlManager.getModelManager(null, ModelEvaluatorFactory.getInstance());
  return evaluator;
}
项目:iot-lab    文件:SparkPredictionBolt.java   
private Evaluator instantiateJPMMLModel() {
  PMML pmml = null;
  try {
    pmml = IOUtil.unmarshal(Launcher.class.getResource("/predictionModel-PMML.xml").openStream());
  } catch (Exception e) {
    e.printStackTrace();
  }
  PMMLManager pmmlManager = new PMMLManager(pmml);
  Evaluator evaluator = (Evaluator) pmmlManager.getModelManager(null, ModelEvaluatorFactory.getInstance());
  return evaluator;
}
项目:tools-idea    文件:aClassLoader.java   
private static synchronized void initSystemClassLoader() {
if (!sclSet) {
    if (scl != null)
    throw new IllegalStateException("recursive call");
           sun.misc.Launcher l = sun.misc.Launcher.getLauncher();
    if (l != null) {
    Throwable oops = null;
    scl = l.getClassLoader();
        try {
        PrivilegedExceptionAction a;
        a = new SystemClassLoaderAction(scl);
                   scl = (ClassLoader) AccessController.doPrivileged(a);
        } catch (PrivilegedActionException pae) {
        oops = pae.getCause();
            if (oops instanceof InvocationTargetException) {
            oops = oops.getCause();
        }
        }
    if (oops != null) {
        if (oops instanceof Error) {
        throw (Error) oops;
        } else {
            // wrap the exception
            throw new Error(oops);
        }
    }
    }
    sclSet = true;
}
   }
项目:consulo-java    文件:aClassLoader.java   
private static synchronized void initSystemClassLoader() {
if (!sclSet) {
    if (scl != null)
    throw new IllegalStateException("recursive call");
           sun.misc.Launcher l = sun.misc.Launcher.getLauncher();
    if (l != null) {
    Throwable oops = null;
    scl = l.getClassLoader();
        try {
        PrivilegedExceptionAction a;
        a = new SystemClassLoaderAction(scl);
                   scl = (ClassLoader) AccessController.doPrivileged(a);
        } catch (PrivilegedActionException pae) {
        oops = pae.getCause();
            if (oops instanceof InvocationTargetException) {
            oops = oops.getCause();
        }
        }
    if (oops != null) {
        if (oops instanceof Error) {
        throw (Error) oops;
        } else {
            // wrap the exception
            throw new Error(oops);
        }
    }
    }
    sclSet = true;
}
   }
项目:Maxine-VM    文件:JDK_java_lang_System.java   
@ALIAS(declaringClass = Launcher.class, name = "<clinit>")
private static native void Launcher_clinit();
项目:Maxine-VM    文件:JavaRunScheme.java   
private Class<?> loadMainClass() throws IOException, ClassNotFoundException {
    final ClassLoader appClassLoader = Launcher.getLauncher().getClassLoader();
    return appClassLoader.loadClass(mainClassName);
}
项目:OpenJSharp    文件:AquaUtils.java   
static boolean shouldUseOpaqueButtons() {
    final ClassLoader launcherClassLoader = Launcher.getLauncher().getClassLoader();
    if (classExists(launcherClassLoader, "com.installshield.wizard.platform.macosx.MacOSXUtils")) return true;
    return false;
}
项目:jdk8u-jdk    文件:AquaUtils.java   
static boolean shouldUseOpaqueButtons() {
    final ClassLoader launcherClassLoader = Launcher.getLauncher().getClassLoader();
    if (classExists(launcherClassLoader, "com.installshield.wizard.platform.macosx.MacOSXUtils")) return true;
    return false;
}
项目:jdk8u_jdk    文件:AquaUtils.java   
static boolean shouldUseOpaqueButtons() {
    final ClassLoader launcherClassLoader = Launcher.getLauncher().getClassLoader();
    if (classExists(launcherClassLoader, "com.installshield.wizard.platform.macosx.MacOSXUtils")) return true;
    return false;
}
项目:lookaside_java-1.8.0-openjdk    文件:AquaUtils.java   
static boolean shouldUseOpaqueButtons() {
    final ClassLoader launcherClassLoader = Launcher.getLauncher().getClassLoader();
    if (classExists(launcherClassLoader, "com.installshield.wizard.platform.macosx.MacOSXUtils")) return true;
    return false;
}
项目:intellij-ce-playground    文件:aClassLoader.java   
static URLClassPath getBootstrapClassPath() {
if (bootstrapClassPath == null) {
    bootstrapClassPath = sun.misc.Launcher.getBootstrapClassPath();
}
return bootstrapClassPath;
   }
项目:infobip-open-jdk-8    文件:AquaUtils.java   
static boolean shouldUseOpaqueButtons() {
    final ClassLoader launcherClassLoader = Launcher.getLauncher().getClassLoader();
    if (classExists(launcherClassLoader, "com.installshield.wizard.platform.macosx.MacOSXUtils")) return true;
    return false;
}
项目:jdk8u-dev-jdk    文件:AquaUtils.java   
static boolean shouldUseOpaqueButtons() {
    final ClassLoader launcherClassLoader = Launcher.getLauncher().getClassLoader();
    if (classExists(launcherClassLoader, "com.installshield.wizard.platform.macosx.MacOSXUtils")) return true;
    return false;
}
项目:OLD-OpenJDK8    文件:AquaUtils.java   
static boolean shouldUseOpaqueButtons() {
    final ClassLoader launcherClassLoader = Launcher.getLauncher().getClassLoader();
    if (classExists(launcherClassLoader, "com.installshield.wizard.platform.macosx.MacOSXUtils")) return true;
    return false;
}
项目:tools-idea    文件:aClassLoader.java   
static URLClassPath getBootstrapClassPath() {
if (bootstrapClassPath == null) {
    bootstrapClassPath = sun.misc.Launcher.getBootstrapClassPath();
}
return bootstrapClassPath;
   }
项目:openjdk-jdk7u-jdk    文件:AquaUtils.java   
static boolean shouldUseOpaqueButtons() {
    final ClassLoader launcherClassLoader = Launcher.getLauncher().getClassLoader();
    if (classExists(launcherClassLoader, "com.installshield.wizard.platform.macosx.MacOSXUtils")) return true;
    return false;
}
项目:openjdk-icedtea7    文件:AquaUtils.java   
static boolean shouldUseOpaqueButtons() {
    final ClassLoader launcherClassLoader = Launcher.getLauncher().getClassLoader();
    if (classExists(launcherClassLoader, "com.installshield.wizard.platform.macosx.MacOSXUtils")) return true;
    return false;
}
项目:consulo-java    文件:aClassLoader.java   
static URLClassPath getBootstrapClassPath() {
if (bootstrapClassPath == null) {
    bootstrapClassPath = sun.misc.Launcher.getBootstrapClassPath();
}
return bootstrapClassPath;
   }
项目:lightmare    文件:EjbClassLoader.java   
/**
 * Implementation of parent {@link URLClassLoader} and {@link ClassLoader}
 * class method for filter parent ClassLoader and current
 * {@link ClassLoader}'s resources
 *
 * @return {@link Enumeration}
 */
static Enumeration<Resource> getBootstrapsResources(String name) {
    return Launcher.getBootstrapClassPath().getResources(name);
}