Examples of JarClassLoader


Examples of scalaExec.ClassLoaders.JarClassLoader

                        Vector toolboxClasses=null;
               
                        if (GlobalValues.displayedToolboxes.contains(jarFileSelected)==false) {    // not displayed  toolbox
                            GlobalValues.displayedToolboxes.add(jarFileSelected);
                        try {
                            GlobalValues.ScalaToolboxesLoader = new JarClassLoader()// instantiate a .jar ClassLoader
                            GlobalValues.ScalaToolboxesLoader.extendClassPath(jarFileSelected);
                            toolboxClasses = GlobalValues.ScalaToolboxesLoader.scanAllJarClasses(jarFileSelected);
                        }
                        catch (java.io.IOException ioe) {
                            System.out.println("IO Exception in reading from "+jarFileSelected);
View Full Code Here

Examples of scalaExec.ClassLoaders.JarClassLoader

                    if (currentDirElem.endsWith(".jar")) {
                        String jarFileSelected = currentDirElem;
                        Vector toolboxClasses=null;
                       
                        try {
                            GlobalValues.ScalaToolboxesLoader = new JarClassLoader();
                            GlobalValues.ScalaToolboxesLoader.extendClassPath(jarFileSelected);
                            toolboxClasses = GlobalValues.ScalaToolboxesLoader.scanAllJarClasses(jarFileSelected);
                        }
                        catch (java.io.IOException ioe) {
                            System.out.println("IO Exception in reading from "+jarFileSelected);
View Full Code Here

Examples of xeus.jcl.JarClassLoader

    private static Logger logger = Logger.getLogger( LoadTest.class );

    public void testWithResourceName() throws IOException, InstantiationException, IllegalAccessException,
            ClassNotFoundException, IllegalArgumentException, SecurityException, InvocationTargetException,
            NoSuchMethodException, JclException {
        JarClassLoader jc = new JarClassLoader( new String[] { "test-jcl.jar", "./test-classes" } );

        // New class
        Object testObj = jc.loadClass( "xeus.jcl.test.Test" ).newInstance();
        assertNotNull( testObj );

        // Locally loaded
        testObj = jc.loadClass( "xeus.jcl.test.Test" ).newInstance();
        assertNotNull( testObj );

        testObj.getClass().getDeclaredMethod( "sayHello", null ).invoke( testObj, null );
    }
View Full Code Here

Examples of xeus.jcl.JarClassLoader

    }

    public void testWithClassFolder() throws IOException, InstantiationException, IllegalAccessException,
            ClassNotFoundException, IllegalArgumentException, SecurityException, InvocationTargetException,
            NoSuchMethodException, JclException {
        JarClassLoader jc = new JarClassLoader( new String[] { "./test-classes" } );

        Object testObj = jc.loadClass( "xeus.jcl.test.Test" ).newInstance();
        assertNotNull( testObj );

        testObj.getClass().getDeclaredMethod( "sayHello", null ).invoke( testObj, null );
    }
View Full Code Here

Examples of xeus.jcl.JarClassLoader

            ClassNotFoundException, IllegalArgumentException, SecurityException, InvocationTargetException,
            NoSuchMethodException, JclException, URISyntaxException {
        // URL url = new URL("http://localhost:8080/blank/test-jcl.jar");
        File f = new File( "test-jcl.jar" );

        JarClassLoader jc = new JarClassLoader( new URL[] { f.toURI().toURL() } );
        Object testObj = jc.loadClass( "xeus.jcl.test.Test" ).newInstance();
        assertNotNull( testObj );

        testObj.getClass().getDeclaredMethod( "sayHello", null ).invoke( testObj, null );
    }
View Full Code Here

Examples of xeus.jcl.JarClassLoader

    public void testWithInputStream() throws IOException, InstantiationException, IllegalAccessException,
            ClassNotFoundException, IllegalArgumentException, SecurityException, InvocationTargetException,
            NoSuchMethodException, JclException {
        FileInputStream fis = new FileInputStream( "test-jcl.jar" );
        JarClassLoader jc = new JarClassLoader( new FileInputStream[] { fis } );
        Object testObj = jc.loadClass( "xeus.jcl.test.Test" ).newInstance();
        assertNotNull( testObj );

        testObj.getClass().getDeclaredMethod( "sayHello", null ).invoke( testObj, null );
        fis.close();
    }
View Full Code Here

Examples of xeus.jcl.JarClassLoader

    }

    public void testAddingMoreResources() throws IOException, InstantiationException, IllegalAccessException,
            ClassNotFoundException, IllegalArgumentException, SecurityException, InvocationTargetException,
            NoSuchMethodException, JclException {
        JarClassLoader jc = new JarClassLoader();
        jc.add( "./test-classes" );
        Object testObj = jc.loadClass( "xeus.jcl.test.Test" ).newInstance();
        assertNotNull( testObj );

        testObj.getClass().getDeclaredMethod( "sayHello", null ).invoke( testObj, null );
    }
View Full Code Here

Examples of xeus.jcl.JarClassLoader

    }

    public void testChangeClassLoadingOrder() throws IOException, InstantiationException, IllegalAccessException,
            ClassNotFoundException, IllegalArgumentException, SecurityException, InvocationTargetException,
            NoSuchMethodException, JclException {
        JarClassLoader jc = new JarClassLoader();
        jc.getSystemLoader().setOrder( 1 );
        jc.getParentLoader().setOrder( 3 );
        jc.getLocalLoader().setOrder( 2 );

        jc.add( "./test-classes" );

        // Should be loaded from system
        Object testObj = jc.loadClass( "xeus.jcl.test.Test" ).newInstance();
        assertNotNull( testObj );

        testObj.getClass().getDeclaredMethod( "sayHello", null ).invoke( testObj, null );
    }
View Full Code Here

Examples of xeus.jcl.JarClassLoader

    }

    public void testInterfaceCast() throws IOException, InstantiationException, IllegalAccessException,
            ClassNotFoundException, IllegalArgumentException, SecurityException, InvocationTargetException,
            NoSuchMethodException, JclException {
        JarClassLoader jc = new JarClassLoader();
        jc.add( "test-jcl.jar" );

        JclObjectFactory factory = JclObjectFactory.getInstance();
        Object serializable = factory.create( jc, "xeus.jcl.test.Test" );

        Serializable s = JclUtils.cast( serializable, Serializable.class );
View Full Code Here

Examples of xeus.jcl.JarClassLoader

    }

    public void testUnloading() throws IOException, InstantiationException, IllegalAccessException,
            ClassNotFoundException, IllegalArgumentException, SecurityException, InvocationTargetException,
            NoSuchMethodException, JclException {
        JarClassLoader jc = new JarClassLoader( new String[] { "./test-classes" } );

        Object testObj = null;
        jc.loadClass( "xeus.jcl.test.Test" );
        jc.unloadClass( "xeus.jcl.test.Test" );

        try {
            // Should get loaded from system
            testObj = jc.loadClass( "xeus.jcl.test.Test" ).newInstance();
            assertNotNull( testObj );
            return;
        } catch (ClassNotFoundException cnfe) {
            if( logger.isTraceEnabled() )
                logger.trace( cnfe );
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.