Package java.net

Examples of java.net.URLClassLoader$URLJarHandler


    if (mFileClassLoaderHash == null) {
      mFileClassLoaderHash = new HashMap();
    }
   
    String baseurlAsString = baseurl.toExternalForm();
    URLClassLoader loader = (URLClassLoader) mFileClassLoaderHash.get(baseurlAsString);
    if (loader == null) {
      loader = new URLClassLoader(new URL[] { baseurl });
      mFileClassLoaderHash.put(baseurlAsString, loader);
    }
   
    return loader;
  }
View Full Code Here


        throw new RegainException("Jar file does not exist: "
                + jarFile.getAbsolutePath());
      }

      try {
        classLoader = new URLClassLoader(new URL[]{jarFile.toURI().toURL()}, superClass.getClassLoader());
      } catch (MalformedURLException exc) {
        throw new RegainException("Creating class loader for "
                + "jar file failed: " + jarFile.getAbsolutePath(),
                exc);
      }
View Full Code Here

   }

   protected void setUp() {
      this.glob = Global.instance();

      URLClassLoader cl = (URLClassLoader)this.getClass().getClassLoader();
      URL[] urls = cl.getURLs();
      String path = "";
      for( int i = 0; i < urls.length; i++ ) {
         String file = urls[i].getFile();
         // TODO: parser.jar is not used anymore, remove code below
         if( file.endsWith("parser.jar") ) {
            int pos = file.indexOf("parser.jar");
            path = urls[i].getProtocol()+"://"+file.substring(0,pos);
            break;
         }
      }

      // Add a xerces.jar at the beginning, so that CLASSPATH contains another XML-Parser in front.
      try {
         urls = new URL[2];
         urls[0] = new URL(path+"ant/xerces.jar");
         urls[1] = new URL(path+"xmlBlaster.jar");
      }
      catch (MalformedURLException ex) {
         log.severe("error. >>>"+ex.toString());
      }

      cl = cl.newInstance(urls);
      try {
         Class clazz = cl.loadClass("org.xmlBlaster.util.EmbeddedXmlBlaster");
      }
      catch (ClassNotFoundException ex) {
         assertTrue(ex.getMessage(), true);
      }
View Full Code Here

                    getLog().debug("adding to classpath '" + file + "'");
                }
                classpathUrls.add(file.toURI().toURL());
            }
        }
        final URLClassLoader loader =
            new URLClassLoader((URL[])classpathUrls.toArray(new URL[0]),
                Thread.currentThread().getContextClassLoader());
        Thread.currentThread().setContextClassLoader(loader);
    }
View Full Code Here

          ClassLoader cl = this.getClass().getClassLoader();
          // Its a RealmClassLoader but its a private class and so cant reference grrr !!!
          // but it extends URLClassLoader
          System.err.println( "classloader:" + cl );
          if ( cl instanceof URLClassLoader ) {
            URLClassLoader ucl = (URLClassLoader) cl;
            URL [] urls = ucl.getURLs();
            for (int i = 0; i < urls.length; i++) {
          System.err.println( "cp:" + urls[i] );
        }
          }
          System.out.println( "Exception:" + ncdfe );
View Full Code Here

   
    protected String getClassPath() {
        ClassLoader loader = getClass().getClassLoader();
        StringBuffer classPath = new StringBuffer();
        if (loader instanceof URLClassLoader) {
            URLClassLoader urlLoader = (URLClassLoader)loader;
            for (URL url : urlLoader.getURLs()) {
                String file = url.getFile();
                if (file.indexOf("junit") == -1) {
                    classPath.append(url.getFile());
                    classPath.append(System.getProperty("path.separator"));
                }
View Full Code Here

        RouteType rt =
            RouteTypeUtil.createRouteType("route_1",
                                           sourceSrv, sourcePort,
                                           destSrv, destPort);

        ClassLoader loader = new URLClassLoader(new URL[] {srcDir.toURL()}, null);
        //Test with no code generation.
        TestRouter router = new TestRouter(loader, def, rt);
        try {
            router.init();
            fail("Should throw a WebServiceException with cause of ClassNotFoundError");
View Full Code Here

        File classDir = new File(opDir, "/classes");
        classDir.mkdirs();
       
        RouteTypeUtil.invokeWSDLToJava(wsdlUrl, opDir, classDir);

        URLClassLoader loader =
            URLClassLoader.newInstance(new URL[] {classDir.toURL()},
                                       getClass().getClassLoader());
        return loader;
    }
View Full Code Here

                    getLog().debug("adding to classpath '" + file + "'");
                }
                classpathUrls[ctr] = file.toURL();
            }

            final URLClassLoader loader =
                new ConfigurationClassLoader(classpathUrls,
                    Thread.currentThread().getContextClassLoader());
            Thread.currentThread().setContextClassLoader(loader);
        }
    }
View Full Code Here

        File classDir = new File(opDir, "/classes");
        classDir.mkdirs();
       
        rm.testInvokeWSDLToJava(opDir, classDir);
       
        URLClassLoader loader =
            URLClassLoader.newInstance(new URL[] {classDir.toURL()},
                                       null);
       
        Class<?> clz = loader.loadClass("org.objectweb.header_test.TestHeader");
        assertNotNull("TestHeader class instance should be present", clz);
       
        clz = loader.loadClass("org.objectweb.header_test.types.ObjectFactory");
        assertNotNull("ObjectFactory class instance should be present", clz);
       
        clz = loader.loadClass("org.objectweb.hwrouter.types.FaultDetail");
        assertNotNull("FaultDetail class instance should be present", clz);
       
        try {
            clz = loader.loadClass("org.objectweb.hwrouter.types.NotPresent");
            fail("Should throw a ClassNotFoundException");
        } catch (ClassNotFoundException cnfe) {
            //Expecetd Exception
        }
    }
View Full Code Here

TOP

Related Classes of java.net.URLClassLoader$URLJarHandler

Copyright © 2018 www.massapicom. 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.