Java Language The Classpath Dynamic Classpath


Sometimes, just adding all the JARs from a folder isn't enough, for example when you have native code and need to select a subset of JARs. In this case, you need two main() methods. The first one builds a classloader and then uses this classloader to call the second main().

Here is an example which selects the correct SWT native JAR for your platform, adds all your application's JARs and then invokes the real main() method: Create cross platform Java SWT Application