How to include and call exe file in jar?

Hi, I am writing a Java application that calls an external exe file to accomplish some tasks. In order to make the program more user friendly, I would like to package the Java application and the exe file into one JAR file and distribute that JAR file to users. I tried to package all these files by running the following command:
jar cmf manifest.txt java_class_file exe_fileThe manifest.txt contains only the following entry:
Main-Class: java_class_fileHowever, when I execute the program with java -jar bundle.jar, the JVM complains that it cannot find the exe file. (Everything works fine when I run the original class file with java)
Would anyone kindly teach me how to do this?
Thanks in advance!

You cannot call an exe file in a jar.
You can have the jar unpack the exe and then run it however.

Similar Messages

  • How to open and play .exe file in Mac?

    I am a new Mac user from of course Windows. I have a CD product catalogue which comes in a .exe format. There seemed no way that I can view the contents in Mac.
    Does anyone have any solution for this?
    Any help is most appreciate

    As Thomas A Reed points out, an exe file is a windows application. I don't know why a product catalog would be in an exe file but I suppose it's possible. It seems more likely that the exe file is an application that either downloads the catalog or opens and displays a disk file containing the catalog; in the latter case you may already have the actual product catalog on your disk drive. Your might try using Spotlight to search for files with names containing key words related to your product catalog name. You also could use Spotlight to search file contents for key words you may recall from the catalog contents. Finally, is this possible: Use your old Windows PC or borrow one and run your "product catalog." While it is running, check for an option to export the information you need to a file in a format (say, text) that is readable on your Mac.

  • Can i load and run  .exe file from jar file??

    I generated a .jar file witch contain an executable (.exe file) under a directory called 'exec'. I can't execute this exe file using
    URL urlExecutable = DlgueLancement.class.getResource("/exec/myPrograme.exe");

    import java.io.*;
    import java.util.jar.*;
    import java.util.zip.*;
    public class Extracter
        public static File extract(File archive, String filename, File target) throws IOException, ZipException
            if( archive == null )
                throw new IllegalArgumentException("Null archive file");
            if( !archive.exists() )
                throw new IllegalArgumentException("Specified archive does not exists");
            if( !archive.isFile() )
                throw new IllegalArgumentException("Specified archive file is not a file");
            if( filename == null )
                throw new IllegalArgumentException("Null filename");
            if( filename.length() == 0 )
                throw new IllegalArgumentException("Empty filename");
            if( target == null )
                throw new IllegalArgumentException("Null target");
            if( target.exists() && file.length() > 0 )
                throw new IllegalArgumentException("Target file already exists and cannot be overwritten");
            JarFile jar_archive = new JarFile(archive);
            ZipEntry entry      = jar_archive.getEntry(filename);
            if( entry == null )
                return null;
            InputStream istream = null;
            FileOutputStream ostream = null;
            try
                istream = jar_archive.getInputStream(entry);
                if( istream.available() == 0 )
                    return null;
                byte[] buffer = new byte[istream.available()];
                istream.read(buffer);
                ostream = new FileOutputStream(target);
                ostream.write(buffer);
                return target;
            finally
                if( istream != null )
                    try{istream.close();}catch(Exception e){}
                if( ostream != null )
                    try{ostream.close();}catch(Exception e){}
    }

  • Include and call an .exe file inside my jar file

    Hi.
    I want to include an exe file and call it inside my jar file. this is the code.
    InputStream is = getClass().getResourceAsStream("/native/my.exe");
              int[] line = new int[is.available()];
              File myFile = File.createTempFile("my","exe");
              myFile.deleteOnExit();
              myFile.setExecutable(true);
              FileOutputStream out = new FileOutputStream(myFile.getAbsolutePath());
              int i = 0;
              int c;
              while((c=is.read()) != -1){
                   line=c;
                   i++;
              is.close();
              for(int j= 0;j<line.length;j++)
                   out.write(line[j]);
              out.close();
    So i store it in my temp folder. Than i run
    String myFileLocation = myFile.getAbsolutePath();
    p = rt.exec(myFileLocation);
    Everything goes fine, but the behaviour of the .exe file is not the same. I mean when i run the commands
    PrintWriter writer = new PrintWriter(p.getoutputStream());
    writer.println("command");
    the behaviour is not the same. What goes wrong.

    But to load the xml file I need to create a File objectIf this is true then you will not be able to load the XML file, since a jar entry is not a File object and cannot be represented as one.
    However if you get rid of whatever it is that loads your XML file and replace it by more standard JAXP processing, you should be able to parse an InputStream that reads from the jar entry. You know how to get that so it should not be a problem.

  • How to run an external .exe file from an indesign pluging

    Hi,
          Suppose if I have written an separate application in C++ (.exe file) & need to run it from an indesign pluging(as if a service in windows). have you provided that facilities in your SDK? if it's please let me know how to run an external .exe file from a indesign pluging.
    Thanks,

    I'm actully writing data in PMString to a external txt file.
    another question..
    if i want to execute an action when the ok button is cliked how can i do it?
    whe i add a button(widget) i know how to handle it. please see my code.
    // Call the base class Update function so that default behavior will still occur (OK and Cancel buttons, etc.).
    CDialogObserver::Update(theChange, theSubject, protocol, changedBy);
    do
    InterfacePtr<IControlView> controlView(theSubject, UseDefaultIID());
    ASSERT(controlView);
    if(!controlView) {
    break;
    // Get the button ID from the view.
    WidgetID theSelectedWidget = controlView->GetWidgetID();
    if (theChange == kTrueStateMessage)
    //if (theSelectedWidget == kEXTCODGoButtonWidgetID
    switch(theSelectedWidget.Get())
             case kEXTCODGoButtonWidgetID:
      this->ViewOutput();
      break;
             case kEXTCODFindButtonWidgetID:
      this->SaveLog();
      break;
    // TODO: process this
    } while (kFalse);
    I do two actions "SaveLog" & "ViewOutput()" using two buttons. But i dont know how to execute an action when the ok button is clicked...

  • How can I Create a exe file were a tab control on it work`s

    I have a VI with many controls and indicators,these are spread on a tab control.This tab control works with out any problems but if i create a exe file then the tab control is fixed. How can I create a exe file so that the tab control on it work´s ?"
    Attachments:
    project7.1.jpg ‏129 KB

    Make the tab control a control and not an indicator. If you want to write
    to it you need to create a local variable.
    "Carlos-R." wrote in message
    news:[email protected]..
    I have a VI with many controls and indicators,these are spread on a
    tab control.This tab control works with out any problems but if i
    create a exe file then the tab control is fixed. How can I create a
    exe file so that the tab control on it work´s ?"

  • How can I create a exe file with a tab control on it that work´s ?

    I have a VI with many controls and indicators,these are spread on a tab control.This tab control works with out any problems but if i create a exe file then the tab control is fixed. How can I create a exe file so that the tab control on it work´s ?

    I have made a new Posting with the same question but this time I added a screenshot of the VI.
    Attachments:
    project7.1.jpg ‏129 KB

  • How to streamline and remove duplicate files on my HD before I backup?

    How to streamline and remove duplicate files on my HD before I backup?
    is there a good program or freeware that can automate and isolate when I have
    duplicate files hiding in the many folders on my Drive... Yes, in a perfect world
    I should know better than having a Drive that is not perfectly organized
    I think there is something called SpringCleaning for windows
    is there something like this for Mac?
    Time machine won't let you remove something after you realized you backed
    up two of the same files... Thanks for ideas

    +is there a good program or freeware that can automate and isolate when I have
    duplicate files hiding in the many folders on my Drive.+
    You should back up your drive with Time Machine before you delete any files in case you make a mistake.
    Tidy Up! - 1.3.2
    http://www.versiontracker.com/dyn/moreinfo/macosx/17908
    +Time machine won't let you remove something after you realized you backed
    up two of the same files.+
    Click on the Time Machine browser icon on the dock. Locate the duplicate file you wish to delete and highlight it. Click on the button with the gear on and choose Delete "all backups of".

  • How to include more than 12 files in a new PDF document?

    I have a Adobe PDF Pack, and when I click on crating a new PDF document, they say that I cannot combine more than 12 files...!
    And I want to have a document of hundreds of pages!
    Someone can help me?
    Pleeeeaaase!!!!!!

    Hi Hisami,
    Thank you very, very much!
    It is very useful what you explain.
    One only question, since I have the trying version of Acrobat Pro: how many files can you combine at the time with it?
    May be it depends on the files size.
    I tried yesterday to combine 50 files at the time and it just blocked everything...
    Thanks a lot!
    Have a very good day.
    Henric
    Henric Caldas
    30 rue de Belleville
    75020 Paris
    Home : +33.1.46.36.04.55
    Mobile : +33.6.59.08.02.27
    [email protected]
    Le 28 janv. 2014 à 22:48, "H.Spector" <[email protected]> a écrit :
    Re: How to include more than 12 files in a new PDF document?
    created by H.Spector in Adobe PDF Pack (formerly CreatePDF) - View the full discussion
    To combine more than 12 files into a single PDF file:
    1. Combine file 1 to file 12 then name it (combined 1 for example)
    2. Combine file 13 to file 24 then name it (combined 2 for example)
    3. Keep doing those steps #1 and #2 then combine "combined 1, Combine 2.....Combine 12).
    Another way is to use Adobe Acrobat. Please download Acrobat XI Pro Trial version from www.adobe.com or you can upgrade your subscription to Acrobat Plus(please see more information about Acrobat Plus subscription at https://www.acrobat.com/acrobatplus/en/home.html?trackingid=JPZKR).
    In Acrobat XI Pro:
    1. Launch Acrobat
    2. Select "File" menu > Create > Combine Files into a Single PDF
    3. Click "Add Files" button at top left corner
    4. After adding your files click "Combine" button at the bottom of the dialog.
    Thank you
    Hisami
    Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/6062261#6062261
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: http://forums.adobe.com/message/6062261#6062261
    To unsubscribe from this thread, please visit the message page at http://forums.adobe.com/message/6062261#6062261. In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in Adobe PDF Pack (formerly CreatePDF) at Adobe Community
    For more information about maintaining your forum email notifications please go to http://forums.adobe.com/thread/416458?tstart=0.

  • How to embed and launch ipa file from another ipa package created using Air for iOS

    Hi Guys,
    Anybody out there knowing how to embed and launch ipa file from another ipa package created using Air for iOS ?
    I am having 1 ipa file created using Xcode, Now i need to include that file in my ipa Package which is created using Flash CS 5.5 and Air for iOS. Also i need to know how to open my 1st ipa file from AS3 ?
    Thanks,

    Hi Sir,
    Thanks for your reply.
    But in that case user need to download 2 applications right. I need user to download my parent application created using Flash and that package contain one more ipa created using Xcode, so from my parent app only user should able to open my 2nd app. Is there any way to do that?
    Ps:  I am not talking about in-app but 2 individual apps inside one package.

  • File Lock - How to lock and unlock a file ? Can we do that for an FTP File?

    Hi All,
    I like to retrieve a file from the FTP server using Apache Commons Net libraries.
    for example if the file size is 20MB. When the file is in the progress of copying or transferring from the FTP server i need to lock the local file which is in our local directory so that no other process will use the same local file which is in the process of copying otherwise partially copied files will be used by another process.
    the file should be locked when it was in the progress of copying from the server. I have an automatic process which will access file objects at certain time and try to process the files.
    I like to know the simplest and easiest way to lock and unlock a file object locally which is trying to copy a file from the FTP server which is of huge size.
    And also i like to know how to lock and unlock a file in general?
    Thanks,
    J.Kathir

    we can set it read only only when it complete finishing the writing.
    can we able to make the file as read-only while transferring data to file.
    How to achieve it ? pls give me some sample code

  • How to create and call a COM component in Java

    Hi All,
    can you suggest how to create and call a COM component..or if have any sample simple application can you send it to me...i will try to develop my project.
    actually i am configuring a OCR Engine using SDK which is in VB .Net when i contacted their support they told that if i have any sample COM based component Project they will help me...
    So please can you help in this.
    Thanks in advance.

    As said by my fellow posters Java Devolopment Environment (Except Microsoft implementation of JVM,this is no longer supported by MS themseleves) does not provide an built-in support to serve this cause.
    If you are looking to devolop a custom based solution the below is a good place to start with where end user is talking about Java <=> JNI <=> Native <=> COM connectivity.
    [http://bloggershetty.blogspot.com/2004/12/java-jni-com-activex-bridge-lots-of.html]
    However,if you are looking for ready made solutions ?
    Implementation any one of the solutions stated below might serve your cause.
    Open Source Solutions:
    [http://j-interop.org/]
    [http://www.danadler.com/jacob/]
    Commercial Solutions:
    [http://javacombridge.com/]
    [http://www.jnbridge.com/]
    [http://www.nevaobject.com/j2cdetails.asp?kw=java%20com%20bridge]
    [http://j-integra.intrinsyc.com/]
    Hope this might help :)
    REGARDS,
    RaHuL

  • How to create and call webservices in VC?

    Hi Experts,
    Please tell me the steps to create web services and how to connect and call in VC.
    Regards,
    Nutan

    Hi,
    all steps are described in the two attached document:
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a160392c-0e01-0010-7784-9cc564d871d2">How to Consume ES Workplace Enterprise Services in Visual Composer</a>
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e017128b-0c01-0010-fa85-e3a576f1a40d">Consume a Web Service from Visual Composer</a>
    Rgds,
    Karim

  • How to upload  and download a files into AL11 directory in ABAP

    Hi,
                   How to upload  and download a files into AL11 directory in ABAP
    thanks
    Moderator message: please search for available information/documentation.
    Edited by: Thomas Zloch on Mar 21, 2011 9:18 AM

    You should try one of these forums for an answer to your question:
    http://swforum.sun.com/jive/forum.jspa?forumID=116
    http://community.java.net/netbeans
    http://linux.java.net

  • How to compile and run java files on a mac using command line?

    can someone tell me or link me to some article on how to compile and run java files from command line on a mac? I have mac OS X leopard

    What do you mean by "where to put them" ? What do you want to put anywhere ?
    Have you read Peter's comment in brackets ? Perhaps you have a classpath problem ?
    Edited by: Michael_Knight on Aug 31, 2008 4:23 AM

Maybe you are looking for

  • Why won't my printer print with Windows 8?

    Why won’t my printer print with Windows 8? Have you just upgraded, or purchased a new computer with Windows 8, and now you can’t get your printer to work?  If so, this may help you.  A lot of people have questions about installing their printer on a

  • Balances showing in stock Account even stock is zero

    HI, When i have run tcode FAGLL03 and enter Stock G/L Account with company code X000, profit center Y000, Selected All Items-Posting date, than it is showing balances in the entered G/L Account of Rs. 40000, Even Stock in relevant Plant/Profit center

  • Product Bar coding in SAP

    Hi, Our client wants to do bar coding in SAP. BAR coding is the code which we find in products to identify the manufacturing and other details about the products. If it is possible in SAP, what are the requirements? We use SAP version 4.6B Awaiting f

  • Takes over an hour to backup & sync...

    Am I missing something?

  • Sharing airport express internet connection with router and wired network

    Dear, I want to set up the following network, but can't succeed. Components: 2 Powermacs quad G5's (airport and two ethernet ports) 2 Powerbooks G4 (airport and 1 ethernet port) 1 broadband wired router (1 Wan and 4 Lan ports) 1 airport express 1 cab