Package java.net

Examples of java.net.URLClassLoader


        // What is this ??
        urls.add(new File(clctxt.getRealPath("/")).getCanonicalFile().toURL());

        URL urlsA[]=new URL[urls.size()];
        urls.toArray(urlsA);
        loader = new URLClassLoader(urlsA, this.getClass().getClassLoader());

    }
View Full Code Here


        urls.add(new File(
                clctxt.getRealPath("/")).getCanonicalFile().toURI().toURL());

        URL urlsA[]=new URL[urls.size()];
        urls.toArray(urlsA);
        loader = new URLClassLoader(urlsA, this.getClass().getClassLoader());

    }
View Full Code Here

          // HACK for now
          compileClassPath = compileClassPath.replace("jre", "jdk");
          compileClassPath += "/lib/tools.jar";
          info.append("    checking default compiler in " + compileClassPath + "\n");
          try {
            javaCompiler = Class.forName(compiler, true, new URLClassLoader(new URL[] { new URL("file",
                "localhost", compileClassPath) }));
          } catch (Error er) {
            log.error("Setting up Java compiler error ", er);
          } catch (Exception ex) {
            log.error("Setting up Java compiler exception ", ex);
View Full Code Here

        // What is this ??
        urls.add(new File(clctxt.getRealPath("/")).getCanonicalFile().toURL());

        URL urlsA[]=new URL[urls.size()];
        urls.toArray(urlsA);
        loader = new URLClassLoader(urlsA, this.getClass().getClassLoader());

    }
View Full Code Here

                    try {
                        //
                        // we need to pass context classloader here, so the jsps can reference /WEB-INF/classes and
                        // /WEB-INF/lib. JspCompilationContext would only take URLClassLoader, so we fake it
                        //
                        URLClassLoader classLoader = new URLClassLoader(new URL[]{}, context.getLoader().getClassLoader());
                        for (Iterator it = names.iterator(); it.hasNext();) {
                            String name = (String) it.next();
                            long time = System.currentTimeMillis();
                            JspCompilationContext jcctx = createJspCompilationContext(name, false, opt, sctx, jrctx, classLoader);
                            ClassLoader prevCl = ClassUtils.overrideThreadContextClassLoader(classLoader);
View Full Code Here

                    //
                    // we need to pass context classloader here, so the jsps can reference /WEB-INF/classes and
                    // /WEB-INF/lib. JspCompilationContext would only take URLClassLoader, so we fake it
                    //
                    compileItem("/", opt, context, jrctx, summary,
                            new URLClassLoader(new URL[]{}, context.getLoader().getClassLoader()), 0, compile);
                } finally {
                    jrctx.destroy();
                }
            }
View Full Code Here

//            catch (IOException e) {
//                Plugin.getDefault().logError("Unable to locate java library location for code completion.", e);
//            }                      
//        }
       
        return new URLClassLoader(jarURLs.toArray(new URL[0]));
    }
View Full Code Here

      this.obj = obj;
    }
  }
 
  @Test public void testDeserializationUnknownException() throws Exception {
    ClassLoader cl = new URLClassLoader(new URL[] {UnitTestUtil.getTestDataFile("test.jar").toURI().toURL()}); //$NON-NLS-1$
    Object obj = ReflectionHelper.create("test.Test", null, cl); //$NON-NLS-1$
   
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(baos);
        oos.writeObject(new ExceptionHolder(new BadException(obj)));
View Full Code Here

        assertTrue(e instanceof SQLException);
        assertEquals("Remote java.sql.SQLException: something bad happended", e.getMessage()); //$NON-NLS-1$
 
 
  @Test public void testDeserializationUnknownChildException2() throws Exception {
    ClassLoader cl = new URLClassLoader(new URL[] {UnitTestUtil.getTestDataFile("test.jar").toURI().toURL()}); //$NON-NLS-1$
    ArrayList<String> args = new ArrayList<String>();
    args.add("Unknown Exception"); //$NON-NLS-1$
    Exception obj = (Exception)ReflectionHelper.create("test.UnknownException", args, cl); //$NON-NLS-1$
   
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
View Full Code Here

        m.invoke(serverOld);
    }

    private static ClassLoader getClassLoader(String jarFile) throws Exception {
        URL[] urls = { new URL(jarFile) };
        return new URLClassLoader(urls, null);
    }
View Full Code Here

TOP

Related Classes of java.net.URLClassLoader

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.