Package xeus.jcl

Examples of xeus.jcl.JarClassLoader.loadClass()


            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 );
View Full Code Here


        // 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

    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

            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

    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

    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

        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

            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();
View Full Code Here

        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

        jc.getCurrentLoader().setEnabled( false );
        jc.getParentLoader().setEnabled( false );
        jc.getSystemLoader().setEnabled( false );

        try {
            jc.loadClass( "xeus.jcl.test.Test" );
        } catch (ClassNotFoundException e) {
            // expected
            return;
        }
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.