Package java.net

Examples of java.net.URLClassLoader.loadClass()


     
      // Get the Minecraft Class.
      Class<?> mc = null;
      try
      {
        mc = cl.loadClass("net.minecraft.client.Minecraft");
       
        Field f = getMCPathField(mc);
       
        if (f == null)
        {
View Full Code Here


       
        for (String clsName : classes)
        {
          try
          {
            Class<?> cls = cl.loadClass(clsName);
            if (!Runnable.class.isAssignableFrom(cls))
            {
              continue;
            }
            else
View Full Code Here

      else
      {
        System.out.println("Launching with applet wrapper...");
        try
        {
          Class<?> MCAppletClass = cl.loadClass(
              "net.minecraft.client.MinecraftApplet");
          Applet mcappl = (Applet) MCAppletClass.newInstance();
          MCFrame mcWindow = new MCFrame(windowtitle);
          mcWindow.start(mcappl, userName, sessionId, winSize, maximize);
        } catch (InstantiationException e)
View Full Code Here

        if (triggersClasspath != null) {
          File dir = new File(triggersClasspath);
          URL url = dir.toURI().toURL();
          URL[] urls = new URL[] { url };
          classLoader = new URLClassLoader(urls, Trigger.class.getClassLoader());
          triggerClass = (Class<Trigger>) classLoader.loadClass(triggerClassName);
        } else {
          triggerClass = (Class<Trigger>) Class.forName(triggerClassName);
        }

        final Trigger trigger = triggerClass.newInstance();
View Full Code Here

    // well-behaved Java packages work relative to the
    // context classloader. Others don't (like commons-logging)
    Thread.currentThread().setContextClassLoader(classLoader);

    Class<?> mainClass = classLoader.loadClass("org.platformlayer.xaas.web.StandaloneXaasWebserver");
    Method main = mainClass.getMethod("main", new Class[] { args.getClass() });

    main.invoke(null, new Object[] { args });

    // try {
View Full Code Here

         * low on the priority list. */
        /* I should also note this this ability to dynamically reload jobs whose
         * class files have changed only applies to classes not in the classpath. */
        URLClassLoader loader = new URLClassLoader (new URL[] {new URL (codebase)});

        return loader.loadClass (className);
      }
      else {
        throw e;
      }
    }   
View Full Code Here

      try {
         logger.fine("load template class " + className  );
        
         ClassLoader cl = new URLClassLoader( new URL [] { tmpClassesDir.toURI().toURL() }, getClass().getClassLoader() );

         Class cls = cl.loadClass( className );

         Template ret = (Template)cls.newInstance();

         return ret;
      } catch( Exception e ) {
View Full Code Here

                        String className = name.substring(0, index);
                        className = className.replace('/', '.').replace('\\', '.');

                        try {
                            if (className.contains("Driver")) {
                                Class<?> clazz = classLoader.loadClass(className);
                                if (Driver.class.isAssignableFrom(clazz)) {
                                    Driver driver = (Driver) clazz.newInstance();
                                    drivers.add(driver);
                                }
                            }
View Full Code Here

        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 filterName : filtersClass) {
            try {
                f = (Filter) urlC.loadClass(filterName).newInstance();
            } catch (NullPointerException ex) {
                // We failed to load the servlet, let's try directly.
                f = (Filter) Thread.currentThread().getContextClassLoader()
                        .loadClass(filterName).newInstance();
            }
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.