I have a jar file which mentions the main class in the manifest. When I try to execute the jar using the following command
java -cp .;./* com.foo.MainClass
<
Here is a good discussion on this issue.
You will need your own classloader to deal with this. -jar
only respects the information in the Manifest and wildcards are not allowed there.
You might find the example of a reloadable class useful: http://www.exampledepot.com/egs/java.lang/ReloadClass.html
From this,
An executable JAR must reference all the other dependent JARs it requires through the Class-Path header of the manifest file. The environment variable CLASSPATH and any class path specified on the command line is ignored by the JVM if the -jar option is used.