Package java.net

Examples of java.net.URLClassLoader.loadClass()


        URLClassLoader urlC = new URLClassLoader(new URL[]{url},
                Thread.currentThread().getContextClassLoader());

        if (getServletClassName() != null && servlet == null) {
            try {
                servlet = (Servlet) urlC.loadClass(getServletClassName()).newInstance();
            } catch (NullPointerException ex) {
                // We failed to load the servlet, let's try directly.
                servlet = (Servlet) Thread.currentThread().getContextClassLoader()
                        .loadClass(servletClassName).newInstance();
            }
View Full Code Here


        filterChain.setServlet(sc, servlet);

        Filter f;
        for (String fClass : filtersClass) {
            try {
                f = (Filter) urlC.loadClass(fClass).newInstance();
            } catch (NullPointerException ex) {
                // We failed to load the Filter, let's try directly.
                f = (Filter) Thread.currentThread().getContextClassLoader()
                        .loadClass(fClass).newInstance();
            }
View Full Code Here

    // Create new class loader
    // with current dir as CLASSPATH
    final File file = new File("./data/script");
    final ClassLoader loader = new URLClassLoader(new URL[] { file.toURI().toURL() });
    // load class through new loader
    final Class< ? > aClass = loader.loadClass(classname);
    script = (Script) aClass.newInstance();
  }

  @Override
  public boolean load(final Player admin, final List<String> args) {
View Full Code Here

     
      urlClassLoader = new URLClassLoader((URL[])urlList.toArray(new URL[urlList.size()]));
     
      for(String className : classList){ 
        try{
          Class<?> currentClass = urlClassLoader.loadClass(className);
          if((currentClass.getSuperclass().isAssignableFrom(PLUGIN_SUPER_CLASS))){
            AbstractPlugablePanel instance = (AbstractPlugablePanel) currentClass.newInstance();
            PluginDataModel pluginDataModel = new PluginDataModel(instance.getPluginName(), instance.getVersion(), instance.getPluginAuthor(), className);
            retMap.put(pluginDataModel, instance);
            log.info(pluginDataModel.getName()+GettextResource.gettext(Configuration.getInstance().getI18nResourceBundle()," plugin loaded."));
View Full Code Here

                logger.finer("trying RMIClassLoader");

                URLClassLoader url_loader = new URLClassLoader(
                        new URL[] { new URL(codebase) }, loader);

                result = url_loader.loadClass(name);

                // log.info("SUCESSFUL class download "+name+" from "+codebase,
                // new Throwable("TRACE"));

            } catch (ClassNotFoundException ex) {
View Full Code Here

                }
            }
            URLClassLoader loader = new URLClassLoader(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

                logger.finer("trying RMIClassLoader");

                URLClassLoader url_loader = new URLClassLoader(
                        new URL[] { new URL(codebase) }, loader);

                result = url_loader.loadClass(name);

                // log.info("SUCESSFUL class download "+name+" from "+codebase,
                // new Throwable("TRACE"));

            } catch (ClassNotFoundException ex) {
View Full Code Here

                loader = new URLClassLoader(urls, parentLoader);
            else
                loader = new URLClassLoader(urls);

            // Load the LAUNCHER_MAIN_CLASS_NAME class
            launcherClass = loader.loadClass(LAUNCHER_MAIN_CLASS_NAME);

            // Get the LAUNCHER_MAIN_CLASS_NAME class' getLocalizedString()
            // method as we need it for printing the usage statement
            Method getLocalizedStringMethod = launcherClass.getDeclaredMethod("getLocalizedString", new Class[]{ String.class });
View Full Code Here

    _endSrcKeyMap = config.getEndSrcKeyMap();

        File file = new File("ojdbc6-11.2.0.2.0.jar");
    URL ojdbcJarFile = file.toURI().toURL();
    URLClassLoader cl = URLClassLoader.newInstance(new URL[]{ojdbcJarFile});
    _oraclePreparedStatementClass = cl.loadClass("oracle.jdbc.OraclePreparedStatement");
    _setLobPrefetchSizeMethod = _oraclePreparedStatementClass.getMethod("setLobPrefetchSize", int.class);

    validate();
  }
View Full Code Here

        URL[] urls = new URL[] {classURL};
        URLClassLoader child = new URLClassLoader (urls, this.getClass().getClassLoader());

        // load the class
        Class<?> cls = child.loadClass(className);

        // put loaded class into classInfo
        classInfo.loadedClass = cls;
        classInfo.loaded = true;
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.