Run .exe packaged in .jar

Posted by user1471327 on Stack Overflow See other posts from Stack Overflow or by user1471327
Published on 2012-06-21T08:48:45Z Indexed on 2012/06/21 9:16 UTC
Read the original article Hit count: 163

I am trying to merge 2 programs I have made to one .jar file. One program is a .jar written in java and the second one is an .exe written in c++. I put both files to the new .jar, wrote this code but it didn't work. When this code was exported to .jar and executed neither of 2 files ran and I got error "no main manifest attribute, in merged.jar" in cmd. Though it worked perfectly when run in eclipse.

  public class main
    {
        public static void main(String[] args) 
   {
      try 
   {
      Runtime.getRuntime().exec("cmd /c project1.jar");
      Runtime.getRuntime().exec("cmd /c project2.exe");
   }  
   catch(Exception exce)
     { 
     /*handle exception*/
      }
       }
   }

Any idea how to fix this or is there another way to do it? I am new to java, so can't think of anything good. Maybe it would be possible to drop these files to a temporary location in windows and delete them after they're executed?

© Stack Overflow or respective owner

Related posts about java

Related posts about jar