Java Code Examples for jdk.test.lib.Utils#getTestClassPathURLClassLoader()

The following examples show how to use jdk.test.lib.Utils#getTestClassPathURLClassLoader() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Test5057225.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
static void loadAndRunClass(String classname) throws Exception {
    Class cl = Class.forName(classname);
    ClassLoader apploader = cl.getClassLoader();
    ClassLoader loader
            = Utils.getTestClassPathURLClassLoader(apploader.getParent());
    Class c = loader.loadClass(classname);
    Runnable r = (Runnable) c.newInstance();
    r.run();
}
 
Example 2
Source File: Test6805724.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String args[]) throws Exception {
    Class cl = Test6805724.class;
    ClassLoader apploader = cl.getClassLoader();

    // Iterate over all 2^k-1 divisors.
    for (int k = 1; k < Long.SIZE; k++) {
        long divisor = (1L << k) - 1;
        System.setProperty("divisor", "" + divisor);
        ClassLoader loader
                = Utils.getTestClassPathURLClassLoader(apploader.getParent());
        Class c = loader.loadClass(Test6805724.class.getName());
        Runnable r = (Runnable) c.newInstance();
        r.run();
    }
}
 
Example 3
Source File: Test6800154.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception
{
    Class cl = Test6800154.class;
    ClassLoader apploader = cl.getClassLoader();

    // Iterate over all divisors.
    for (int i = 0; i < DIVISORS.length; i++) {
        System.setProperty("divisor", "" + DIVISORS[i]);
        ClassLoader loader
                = Utils.getTestClassPathURLClassLoader(apploader.getParent());
        Class c = loader.loadClass(Test6800154.class.getName());
        Runnable r = (Runnable) c.newInstance();
        r.run();
    }
}
 
Example 4
Source File: Test6603011.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void test_divisor(int divisor,
                                ClassLoader apploader) throws Exception {
  System.setProperty("divisor", "" + divisor);
  ClassLoader loader
              = Utils.getTestClassPathURLClassLoader(apploader.getParent());
  Class c = loader.loadClass(Test6603011.class.getName());
  Runnable r = (Runnable)c.newInstance();
  r.run();
}
 
Example 5
Source File: Test6823354.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
static void loadandrunclass(String classname) throws Exception {
    Class cl = Class.forName(classname);
    ClassLoader apploader = cl.getClassLoader();
    ClassLoader loader
            = Utils.getTestClassPathURLClassLoader(apploader.getParent());
    Class c = loader.loadClass(classname);
    Runnable r = (Runnable) c.newInstance();
    r.run();
}