test.CustomClassLoaderTest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Quaqua Show documentation
Show all versions of Quaqua Show documentation
A Mavenisation of the Quaqua Mac OSX Swing Look and Feel (Java library)
Quaqua Look and Feel (C) 2003-2010, Werner Randelshofer.
Mavenisation by Matt Gumbley, DevZendo.org - for problems with
Mavenisation, see Matt; for issues with Quaqua, see the Quaqua home page.
For full license details, see http://randelshofer.ch/quaqua/license.html
The newest version!
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package test;
import java.lang.reflect.*;
import java.net.*;
/**
*
* @author werni
*/
public class CustomClassLoaderTest {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
try {
// For this test to succeed, Quaqua must not be in the System classpath
if (Class.forName("ch.randelshofer.quaqua.QuaquaLookAndFeel") != null) {
System.err.println("Quaqua must not be in the System classpath for this test to succeed");
}
} catch (ClassNotFoundException ex) {
try {
// All fine, we can proceed with the test.
URLClassLoader l = new URLClassLoader(new URL[]{
new URL("file:./quaqua-test.jar"),
new URL("file:./quaqua.jar"),
});
Class c = l.loadClass("test.QuaquaTest");
Method m = c.getMethod("main", new Class[] {String[].class});
m.invoke(null, new Object[] {args});
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy