Package java.net

Examples of java.net.URLClassLoader.loadClass()


          (URL[]) urlList.toArray(new URL[0]));
      classLoaders.put(alias, classLoader);
      if (className == null) {
        return null;
      } else {
        Class clazz = classLoader.loadClass(className);
        Object instance = clazz.newInstance();
        jsEngine.mount(alias, instance);
        return instance;
      }
    }
View Full Code Here


      }
      ClassLoader cl = new URLClassLoader(paths.toArray(new URL[]{}),
        this.getClass().getClassLoader());
      Thread.currentThread().setContextClassLoader(cl);
      try {
        implClass = cl.loadClass(className);
      } catch (ClassNotFoundException e) {
        throw new IOException(e);
      }
    }
View Full Code Here

            // Note that this means that all instances of the test will share
            // the same asset database, because the URL handlers for asset
            // URLs will always map to this classloader.  For the purpose of
            // most scalability tests, this should be fine.
            ClassLoader loader = new URLClassLoader(jarUrls, getClass().getClassLoader());
            Class c = loader.loadClass("org.jdesktop.wonderland.client.jme.WonderlandURLStreamHandlerFactory");
            URLStreamHandlerFactory factory = (URLStreamHandlerFactory) c.newInstance();
            URL.setURLStreamHandlerFactory(factory);
        } catch (ClassNotFoundException cnfe) {
            throw new ProcessingException(cnfe);
        } catch (InstantiationException ie) {
View Full Code Here

        try {
            URL[] urls = new URL[]{writeJar(processor), writeJar(client)};
            ClassLoader loader = new URLClassLoader(urls, getClass().getClassLoader());

            Class rpClazz = loader.loadClass(clazzName);
            return (RequestProcessor) rpClazz.newInstance();
        } catch (ClassNotFoundException cnfe) {
            throw new ProcessingException(cnfe);
        } catch (InstantiationException ie) {
            throw new ProcessingException(ie);
View Full Code Here

  {
    URL jarURL = new File(jarFileName).toURI().toURL();
   
        try {
            URLClassLoader classLoader = new URLClassLoader( new URL[]{jarURL} );
            Driver driver = (Driver)classLoader.loadClass(driverName).newInstance();
            System.out.println(driver);
            System.out.println("v"+driver.getMajorVersion()+"."+driver.getMinorVersion());
            System.out.println(driver.acceptsURL("jdbc:hsqldb:http://10.0.0.9/logger"));
           
            driver = new JDBCDriverWrapper(driver);
View Full Code Here

      classLoaders.put(alias,classLoader);
     
      if(className==null) {
        return null;
      } else {
        Class clazz = classLoader.loadClass(className);
        Object instance = clazz.newInstance();
        jsEngine.mount(alias,instance);
        return instance;
      }
    }
View Full Code Here

                    }
                }
            }
            URLClassLoader loader = new URLClassLoader((URL[]) list.toArray(new URL[list.size()]), DatabasePoolPortlet.class.getClassLoader());
            try {
                return loader.loadClass(data.driverClass);
            } catch (ClassNotFoundException e) {
                return null;
            }
        } catch (Exception e) {
            e.printStackTrace();
View Full Code Here

            List<URL> tmpUrls = new ArrayList<URL>();
            for (File file: srcPaths) {
                tmpUrls.add(file.toURI().toURL());
            }
            ClassLoader tmpLoader = new URLClassLoader(tmpUrls.toArray(new URL[tmpUrls.size()]), InstrumenterWorker.class.getClassLoader());
            instrumenter = (Instrumenter) tmpLoader.loadClass(instrumenterClassName).newInstance();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
            return srcPaths;
        } catch (InstantiationException e) {
            e.printStackTrace();
View Full Code Here

            assertStreamContains(ENTRY_VALUE + i, url.openStream());
            jarFile.close();

            URLClassLoader urlClassLoader = new URLClassLoader(new URL[] { file.toURL() } );
            // clazz shared by all
            Class clazz = urlClassLoader.loadClass(CLASS_NAME);
            assertNotNull(clazz);
            assertTrue(clazz instanceof Serializable);

            // clazz specific to this jar
            clazz = urlClassLoader.loadClass(CLASS_NAME + i);
View Full Code Here

            Class clazz = urlClassLoader.loadClass(CLASS_NAME);
            assertNotNull(clazz);
            assertTrue(clazz instanceof Serializable);

            // clazz specific to this jar
            clazz = urlClassLoader.loadClass(CLASS_NAME + i);
            assertNotNull(clazz);
            assertTrue(clazz instanceof Serializable);

            // resource shared by all jars
            InputStream in = urlClassLoader.getResourceAsStream(ENTRY_NAME );
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.