Package java.net

Examples of java.net.URLClassLoader.loadClass()


      cache.start();

      URLClassLoader ucl1 = createOrphanClassLoader();
      Thread.currentThread().setContextClassLoader(ucl1);

      Class clazz1 = ucl1.loadClass(INSTANCE_CLASS_NAME);
      cache.put(fqn("/a"), "key", clazz1.newInstance());

      Thread.currentThread().setContextClassLoader(ClassLoader.getSystemClassLoader());
      try
      {
View Full Code Here


      Region region = cache.getRegion(fqn("/"), true);
      region.registerContextClassLoader(Thread.currentThread().getContextClassLoader());
      region.activate();

      Class clazz1 = ucl1.loadClass(INSTANCE_CLASS_NAME);
      cache.put(fqn("/a"), "key", clazz1.newInstance());

      region.deactivate();
      region.unregisterContextClassLoader();
View Full Code Here

        if (debug) {
            System.out.println("gradleJar = " + gradleJar.getAbsolutePath());
        }
        URLClassLoader contextClassLoader = new URLClassLoader(new URL[] { gradleJar.toURI().toURL() });
        Thread.currentThread().setContextClassLoader(contextClassLoader);
        Class<?> mainClass = contextClassLoader.loadClass("org.gradle.launcher.GradleMain");
        Method mainMethod = mainClass.getMethod("main", String[].class);
        mainMethod.invoke(null, new Object[] {args});
    }
}
View Full Code Here

    }

    public Void call() throws Exception {
        URL[] bootstrapUrls = bootstrapClasspath.toArray(new URL[bootstrapClasspath.size()]);
        URLClassLoader classLoader = new URLClassLoader(bootstrapUrls, ClassLoader.getSystemClassLoader().getParent());
        Class<? extends Callable> workerClass = classLoader.loadClass(
                "org.gradle.process.internal.child.SystemApplicationClassLoaderWorker").asSubclass(Callable.class);
        Callable<Void> main = workerClass.getConstructor(Collection.class, byte[].class).newInstance(
                applicationClasspath, serializedWorker);
        return main.call();
    }
View Full Code Here

        }
       
        try {
            URLClassLoader urlClassLoader = new URLClassLoader(WrapUtil.toArray(scriptCacheDir.toURI().toURL()),
                    classLoader);
            return urlClassLoader.loadClass(source.getClassName()).asSubclass(scriptBaseClass);
        } catch (Exception e) {
            throw new GradleException(String.format("Could not load compiled classes for %s from cache.",
                    source.getDisplayName()), e);
        }
    }
View Full Code Here

                    URLClassLoader loader = new URLClassLoader(urls);
                    if (cname == null) {
                        factory = BindingDirectory.getFactory(bname, pname,
                            loader);
                    } else {
                        Class clas = loader.loadClass(cname);
                        if (bname == null) {
                            factory = BindingDirectory.getFactory(clas);
                        } else {
                            factory = BindingDirectory.getFactory(bname, clas,
                                loader);
View Full Code Here

            if (parent == null) {
                parent = TestMultRoundtrip.class.getClassLoader();
            }
            ClassLoader loader = new URLClassLoader(urls, parent);
            Thread.currentThread().setContextClassLoader(loader);
            mclas = loader.loadClass(mname);
        } catch (ClassNotFoundException ex) {
            System.err.println("Class " + mname + " not found");
            return false;
        }
        IBindingFactory bfact;
View Full Code Here

        }
      };
     
      ClassLoader cl = new URLClassLoader(new URL[]{jar_file.toURI().toURL()}, parent);
     
        Class c = cl.loadClass( "org.gudy.azureus2.core3.util.Constants");

        Field  field = c.getField( "AZUREUS_VERSION" );
       
        return((String)field.get( null ));
       
View Full Code Here

 
 
  public Version determineWGAVersion() throws IOException, ClassNotFoundException, IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException {
    File classesDir = new File(getDeployDir(), "WEB-INF/classes");
    URLClassLoader loader = new URLClassLoader(new URL[] {classesDir.toURL()}, this.getClass().getClassLoader());
    Class wgaVersionClass = loader.loadClass("de.innovationgate.wgpublisher.WGAVersion");
    Version version = new Version();
    version.setMajorVersion(wgaVersionClass.getDeclaredField("WGAPUBLISHER_MAJOR_VERSION").getInt(null));
    version.setMinorVersion(wgaVersionClass.getDeclaredField("WGAPUBLISHER_MINOR_VERSION").getInt(null));
    version.setMaintenanceVersion(wgaVersionClass.getDeclaredField("WGAPUBLISHER_MAINTENANCE_VERSION").getInt(null));
    version.setPatchVersion(wgaVersionClass.getDeclaredField("WGAPUBLISHER_PATCH_VERSION").getInt(null));
View Full Code Here

    try {
      File wgutils = new File(getWebappDir(), "libs/wgutils.jar");
      URL[] jars = new URL[1];
      jars[0] = wgutils.toURL();
      URLClassLoader classLoader = new URLClassLoader(jars);
      Class factoryClass = classLoader.loadClass("de.innovationgate.wga.config.WGAConfigurationFactory");
    } catch (MalformedURLException e) {
      return false;
    } catch (ClassNotFoundException e) {
      return false;
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.