title: Loading jar file using JCL(JarClassLoader ) : classpath in manifest is ignored
body: <p>I am trying to load jar file using <a href="http://jcloader.sourceforge.net/gettingstarted.html" rel="nofollow noreferrer">JCL</a> using following code</p>
  
  <pre><code>FileInputStream fis = new FileInputStream(new File( "C:\\Users\\sunils\\glassfish-tests\\working\\test.jar") );
          JarClassLoader jc = new JarClassLoader(  );
          jc.add(fis);
          Class main = jc.loadClass( "highmark.test.Main" );
          String[] str={};
  
          main.getMethod("test").invoke(null);//.getDeclaredMethod("main",String[].class).invoke(null,str);
          fis.close();
  </code></pre>
  
  <p>But when I try to run this program I get Exception as </p>
  
  <pre><code>Exception in thread "main" java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at Main.main(Main.java:21)
  Caused by: java.lang.RuntimeException: Embedded startup not found, classpath is probably incomplete
      at org.glassfish.api.embedded.Server.&lt;init&gt;(Server.java:292)
      at org.glassfish.api.embedded.Server.&lt;init&gt;(Server.java:75)
      at org.glassfish.api.embedded.Server$Builder.build(Server.java:185)
      at org.glassfish.api.embedded.Server$Builder.build(Server.java:167)
      at highmark.test.Main.test(Main.java:33)
      ... 5 more
  </code></pre>
  
  <p>According to this it is not able to locate class, But when I run the jar file explicitly it runs fine. It seems like JCL is ignoring other classes present in the jar file, </p>
  
  <p><code>MANIFEST.MF</code> file in jar file shows: </p>
  
  <pre><code>Manifest-Version: 1.0
  Class-Path: .
  Main-Class: highmark.test.Main
  </code></pre>
  
  <p>It seems to be ignoring <code>Class-Path: .</code> , This jar file runs fine when I run it using Java explicitly, This is just a test, in reality this jar file is coming as a <code>InputStream</code> and it cannot be stored in filesystem,  How can I overcome this problem , Is there any workaround ?</p>
  
  <p>Thanks for any help .</p>
  
  <p>UNDATE: 
  Here is a jar <code>Main</code> class :</p>
  
  <pre><code>package highmark.test;
  import org.glassfish.api.embedded.*;
  
  import java.io.*;
  
  import org.glassfish.api.deployment.*;
  
      import com.sun.enterprise.universal.io.FileUtils;
      public class Main {
          public static void main(String[] args) throws IOException, LifecycleException, ClassNotFoundException {
              test();     
          }
          public static void test() throws IOException, LifecycleException, ClassNotFoundException{
  
          Server.Builder builder = new Server.Builder("test");
  
          Server server = builder.build();
          server.createPort(8080);
          ContainerBuilder containerBuilder = server.createConfig(ContainerBuilder.Type.web); 
          server.addContainer(containerBuilder);
          server.start();
  
  
          File war=new File("C:\\Users\\sunils\\maventests\\simple-webapp\\target\\simple-webapp.war");//(File) inputStream.readObject();
          EmbeddedDeployer deployer = server.getDeployer();
          DeployCommandParameters params = new DeployCommandParameters();
          params.contextroot = "simple";
          deployer.deploy(war, params);
          }
      }
  </code></pre>