[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 219
  • Last Modified:

jar file problems

Hi,
   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] = "mail_args.pl";
            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:
              'mail_args.pl' is not recognized as an internal or external command, operable program or batch file.

mail_args.pl 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
appear.

Anyone got any ideas?

thanks
V
Anyone have any ideas?
0
Bourke
Asked:
Bourke
  • 2
1 Solution
 
nesnemisCommented:
Hi Bourke,

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

nesnemis
0
 
objectsCommented:
you can't run a script out of your jar using exec()
0
 
BourkeAuthor Commented:
I managed to sort out the image not displaying problem.

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

thanks
V
0
 
BourkeAuthor Commented:
Or any alternative solution?
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now