jar file problems

Posted on 2004-11-16
Last Modified: 2010-03-31
   I've just created a jar file.  Part of my app is to send an email.  I do this by using the following:
           String[] cmd = new String[7];

            cmd[0] = "cmd.exe" ;
            cmd[1] = "/C" ;
            cmd[2] = "";
            cmd[3] = strToEmail;  
            cmd[4] = strFromEmail;            
            cmd[5] = strSubject;            
            cmd[6] = strEmailBody;    

            Runtime rt = Runtime.getRuntime();
            Process proc = rt.exec(cmd);

This is fine when I run the app not as a jar file but when I do I get the following error:
              '' is not recognized as an internal or external command, operable program or batch file. is in the jar file.

Also in the app I have icons on the Title bar of the JFrame/JInternalFrames but when running the jar they dont

Anyone got any ideas?

Anyone have any ideas?
Question by:Bourke
    LVL 3

    Accepted Solution

    Hi Bourke,

    you must make shure that is in the directory youre in, if not use the commands cd\...etc

    LVL 92

    Expert Comment

    you can't run a script out of your jar using exec()

    Author Comment

    I managed to sort out the image not displaying problem.

    Would you know how to run a script in a jar without using exec?


    Author Comment

    Or any alternative solution?

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Suggested Solutions

    For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
    Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
    Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
    Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now