Dos executable in .jar file

Yes, you read it correct! Here's what I'd like to do: I have a piece of java that puts a command line together and executes an old dos program. I'd like to bundle this all up into one neat, tidy bundle that a user can copy to their machine & simply double click.
Has anybody attempted something like this and, if yes, how did you do it? Did it work? Should I even bother?
Thanks in advance.

Yes, you read it correct! Here's what I'd like to do:
I have a piece of java that puts a command line
together and executes an old dos program. I'd like to
bundle this all up into one neat, tidy bundle that a
user can copy to their machine & simply double click.
Has anybody attempted something like this and, if yes,
how did you do it? Did it work? Should I even
bother?
i'm not even going to ask why.
but if you already have figured out the starting another process part than all you need to do is make your jar file executable read this http://java.sun.com/docs/books/tutorial/jar/basics/run.html

Similar Messages

  • How to execute a jar file which has an applet, without using a html file ?

    I have a jar file which contains a set of class files. iam able to execute the jar file by using this html code
    <html>
    <applet code="file.class" archive="file.jar" width="500" height="300">
    <param name="name" value="value">
    </applet>
    </html>
    I want to know how to execute this class file without using the html tags.
    pls help me out in this.
    Anki

    Hi,
    You can make an executable jar file such that when you double click on that it starts running. Just follow the steps.
    1. Open a notepad and write the following
    Main-Class: XXXXXXXX
    XXXXXXX means Your Main Class name. Don't forget to press Enter after you write your class name.
    2. Save the file as Mani.mf
    3. In the commant prompt ( your directory ) type following lines.
    jar cmf Mani.mf Demo.jar *.*
    4. This will make a jar file which is executable jar file
    Hope this will help you.
    Deepak

  • How to execute a jar file in a java application

    Hi,
    I've already try to execute a jar file by this way :
    Runtime.getRuntime().exec(java -jar myJarFile.jar);
    But the problem is that the display doesn't launch. Normally a "JFrame" display.
    however the corresponding process is launched.
    So i would to know if there is a way to execute a Jar File without using the Runtime class.
    Is there a specific class for the Jar File?
    Thank you.
    Richard

    Create a 'manifest' file pointing to the 'main' class, jar it into the .jar file, place it onto your desktop - or whereever you can click on it, and click on it.

  • How to execute a jar file in other machine?

    Hi all,
    I am working with java. and my machine is connected to LAN.I would like to execute a jar file in my machine from a remote machine that is also connected to LAN.how should i go about doing this.Help me if somebody have a solution as i am badly in need of this.
    Regards,
    Mohan

    Hi Mohan.tkm,
    If you want it to be done in pure Java and independently of the OS of both computers, you may build a RMI server that will launch your JAR by request of a remote RMI client.
    There's an example of RMI here .

  • Exception is thrown only while executing the jar file

    java.lang.NoClassDefFoundError: javax/mail/Address Exception is thrown only while executing the jar file. But the program compiles and executes good when executed for command prompt through the class files.
    I used javamail API in my program. Classpath and every others are set to the right one's. Executed fine when used java Random.class. But the problem is only with the jar file.
    Please help me out in this regard. Why the exception is thrown only in jar but not at class level.

    Assuming you're running your program using "java -jar", your jar file needs a Class-Path entry
    in the manifest file that references mail.jar.

  • Howto execute java jar file via html ?

    hi
    howto execute java jar file via html ?
    could someone pls post a html code ?
    kind regards
    upiter77

    hi
    howto execute java jar file via html ?You can't.
    could someone pls post a html code ?No. you can search for yourself and find the code you need.
    Now, it sounds to me like you're trying to build an Applet or do Web Start or something. In any event, you need...wait for it....Google! :-)

  • Executing a jar file from an arbitrary folder

    I got a small problem in detemining the path of my application's jar file. I am starting the application by executing a batch, lets say MyApp.bat (using it on windows and unix), this batch file consists of one line 'java -jar MyApp.jar', MyApp.jar being in the same folder.
    Now lets say MyApp.bat and MyApp.jar are in folder 'A' and my current working directory is a parallel folder 'B', so I can invoke the batch file from there(!) by executing '../A/MyApp.bat'. But now the VM tries to find MyApp in the current working directory which is still 'B' and not 'A'. A simple solution would be to use a script which determines the directory of MyApp.jar and include the generated path in the call to the VM (I didn't try yet, but I guess this will awkward doing it on windows)
    Since I don't think I am the first person executing a java program via a script from an arbitrary folder in a file system, I hoped that there might be a more elegant way. Unfortunately I couldn't find another solution yet.
    Regards,
    Stefan

    In MyApp.bat your line should read (NT/2K/XP/2003/Vista):java -jar "%~dp0MyApp.jar"Regards

  • Program not executing in jar file. Help please.

    I went through the tutorial about jars on the sun website and i created a jar file with a hello world program like this:
    "cd E:\Batch
    jar cfm test.jar m.txt test.class
    PAUSE"
    My m.txt contains this text:
    "Main-Class: test.class"
    The jar file is created. No errors.
    Then i try and run the jar with this:
    "cd E:\Batch
    java -jar test.jar
    PAUSE"
    I get "NoClassDefFoundError: test/class"
    All the dos command are run form batch files and everything is in the same directory.
    I've searched around google and this website for answers but i have failed to find anything.
    Does anyone have any suggestions i can try to fix this? I've ran out of ideas.

    Ah thats what the problem was. That was driving me
    mad thanks. So whatever you put in a jar file must be
    in a package or you can't run it.
    Message was edited by:
    JahvahNo. You can also not put it in a package, but when you specify the main-class attribute in the manifest file, be sure that you don't tell it that it is in a package.

  • While executing a jar file I am getting an error

    while exec a jar file i am getting an error
    invalid file (bad magic number): Exec format error
    i tried to execute it with the commnad
    java -jar test.jar
    or by directly too
    ./test.jar

    Than tell me how to launch a jar file I tried different ways like
    java -jar MyJar.jar
    and
    MyJar
    and
    ./MyJar
    but its not worked

  • How do you execute a JAR file?

    I'm sorry this is so basic, but I honestly do not know how to do this nor can I find anything online here or anywhere via Google to help me with this one.
    I have a JAR file that I created on another machine using JDK 1.6.0 and NetBeans 5.5 on WinXP.
    I copied and pasted that JAR file over to my machine at home also using JDK 1.6.0 and NetBeans 5.5 on WinXP
    I put the exact directory name where the JAR file resides, "C:\Program Files\Java\jdk1.6.0\classes", in CLASSPATH and rebooted my machine.
    However, upon CD'ing to that directory and doing "java -classpath . GUI.jar", I get a "NoClassDefFoundError" when trying to do so.
    Furthermore, I was not sure how to use NetBeans to run the JAR file to execute the classes within.
    What did I do wrong? I'm so sorry this is so basic.
    Thanx
    Phil

    You are using netbeans to build your jar. Go to your project properties (right click on the project name and choose properties). Then select "Run" from the tree. You will find a text box "Main Class" there, put the name of the class in there that has your main() method, including full package if you have one. That is WITHOUT the .class extension.
    Build your jar, it will be placed in the dist directory of your netbeans project. You can now run it from netbeans itself if you want. If ever you want to run the jar from the command line on your home machine, just navigate to the directory with the jar file and execute this:
    java -jar yourjar.jarand you're off. If your runtime environment is propertly setup you can even execute the jar by simply double clicking on it from the windows explorer. No need to change the CLASSPATH variable at all, in fact it is ignored when executing a jarred application.
    Also a note: you do not need to reboot your machine when you change an environment property. Simply change them using my computer -> properties -> advanced tab -> environmental variables. If you have any command prompts open, close and reopen them so the properties are updated properly.

  • I get a message every time when I execute one jar file

    I have a problem when I try to execute jar files. I use this command: java -jar jarfile.jar. Ok, the jar file is executed, but I receive many messages while the jar file is executed.
    Message:
    The applet is attempting to invoke the java/lang/System.exit() operation - options: Allow or Disallow or Stop Applet, other example: The applet is attempting to invoke the java/Lang/System.getProperty()
    This is one of many other messages that I receive. I'm trying to install the UML plugin for eclipse (omondo - www.ejb3.com)
    thanks
    Edited by: Dixavado on 06/05/2008 16:36

    iPad- Basic troubleshooting
    Locked Out, Forgot Lock or Restrictions Passcode, or Need to Restore Your Device
    1. iTunes 10 for Mac- Update and restore software on iPod, iPhone, or iPad
    2. iOS- Forgotten passcode or device disabled after entering wrong passcode
    3. iPhone, iPad, iPod touch: Wrong passcode results in red disabled screen
    4. iOS- Understanding passcodes
    5. What to Do If You've Forgotten Your iPhone's Passcode
    6. How to Recover Forgotten iPhone Restrictions Passcode | The iPhone and iPad
    7. Restoring iPod touch after forgotten passcode
    8. RecBoot: Easy Way to Put iPhone into Recovery Mode - if all else fails.
    Forgotten Restrictions Passcode Help
    1. How to Recover Forgotten iPhone, iPad Restrictions Passcode
        If this method does not work, then you will need to fully Restore your
        device as New
    Also, see iTunes- Restoring iOS software.

  • Fatal Exception occurred when trying to execute a JAR file

    Hi,
    I have compiled my project in a jar file with the purpose of having an 'almost' executable file that would run with a simple double click.
    When running this file from the netbeans directory, it works fine, but if I move this jar file to, say, my desktop, then I get an error:
    Fatal Exception occurred. Program will exit.
    Is this normal?
    basically, I would like to create a stand-alon file that I can send to other people who can run it on their machines
    Am I doing the right thing, or missing something?
    P.S I should add that my application needs to read contente from some txt files which are stored in my PC, but that is clearly speficied in the code
    thanks

    I found that if I copy the whole of the dist directory and subdirectories, it works fine. I guess that's what could not be found.
    just for my learning, is that the correct solution: basically send over the whole dist+subdirectories and have the program run from there?
    thanks

  • Executing a jar file

    Hi,
    I wonder why every java program is inside a jar file.
    what am I suppose to do with that file?
    I doble click and it disappear!
    what do you recommend me?
    Thanks

    I think every time you click one, it adds another duplicate or crosspost of the same question!
    [http://forum.java.sun.com/thread.jspa?threadID=5286772]
    [http://forum.java.sun.com/thread.jspa?threadID=5286774]
    [http://forum.java.sun.com/thread.jspa?threadID=5286780]
    Doofus.

  • Java executables and jar files

    I'm new to Java and recently completed a Java training class that involved the creation of a cutomer service application in Microsoft Visual J++. The application ran fine in debug mode. However, no mention was made of how this would be run on a machine without an development tool as J++. How is this done? Can Java programs be compiled into .exe's like C, C++,, abd Visual basic programs? If not, how are the classes called to make use of their code?
    Also, what is a .jar file and how is it used?

    You went to a class and they didn't teach you the answers to these questions? I say go and get your money back: you we're ripped off.
    1) Yes you can turn your java code into an .exe but that would be pointless as java was designed to be "platform independant" and this violates that principle.
    2) jar files are zip files for all intents and purposes. They contain your 'compiled' java byte code.
    3) Microsoft does not support J++ nor does it ship java with its browser anymore so I suggest you download java from this website and use the real thing.

  • Problems executing my jar file

    i wanted to ask how do you jar a file and make it executable at the same
    time
    i did something like this
    jar cfm main.jar Manifest.txt House.class mainInteractiveMap.class
    house.jpg car.jpg map1.txt
    and in the manifest file i have soemthing like this
    Main-Class: MainInteractiveMap
    but when i try to run it like this
    java -jar main.jar
    it gives me an error like this
    exception in thread main java,lang.NoClassDefFoundError:
    MainInteractiveMap
    but the main is in MainInteractiveMap
    regards

    1. Does your application run when do not jar it? If it does run, what command do you use? If it doesn't run, get it to run before you try to jar it.
    2. Does your application run using
    java -cp main.jar MainInteractiveMapIf it doesn't run, you have not jared the MainInteractiveMap correctly. If it does run, then you have a problem in the manifest. For example, there should be a blank line at the end of the Manifest.txt line.

Maybe you are looking for

  • Conversion help needed.

    Hi everybody. I'm new to the forum, and need your assistance. I've recently purchased a Sony 30GB hardrive camcorder and I'm having problems editing the movies in iMovie HD. The problem is that the camera records movies in MPEG2 format, and in order

  • Back to Mac after trying a high end PC laptop! What a joy to be back!!!

    I've been a Mac user since around 1990...a long time in computer years! Anyway, as I was about to start a government job - read: PC - I thought I better switch to PC/Windows and might as well get familiar with it by having one at home. So I go and bu

  • Compatibility PLSSS READ!!!

    heloo, i have the mobo msi 880gm-e41 and the processor AMD phenom II x4 965 which have 125w and  the mobo supports only 95w . is there any update for bios or could i put the proc on the mobo even though the TDP is with 30w higher. will the mobo see m

  • Last time user login in 11i

    COuld anyone tell me how to find out the last time a user login into the application in Oracle eBusiness 11i? I hav ebeen audited and need to receive that data for my auditors ? Thnx

  • Geotagging in iPhoto or Flickr?

    If photos are geotagged in Flickr, is there any way to easily bring that lat/long data into iPhoto? Conversely, if the photos are geotagged in iPhoto, can that geographic info be easily transferred to Flickr? In other words, if I expect to have the p