• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Peter Rooke
  • Himai Minh
Bartenders:
  • Piet Souris
  • Mikalai Zaikin

Executing .exe inside a jar file

 
Ranch Hand
Posts: 431
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ranchers

I am creating a small application which I am going to deliver as a jar file. The main class inside that jar file has to execute one .exe file if some condition is satisfied. I have put the exe file also inside the jar. But while running the jar file, it is not executing the .exe file. If I put the .exe file inside the folder from where I am running the jar file then it is working fine. But I cannot deliver as a jar file and a exe file.What can I do now?

By the way, I am using Runtime.getRuntime().exec() method to execute the exe file from the java program. Help me out friends.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You won't get it to execute from within the jar file - you need to extract it into the directory, and run it from there.
 
Ranch Hand
Posts: 275
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If it wasn't clear from the previous post, you might try opening the jar file (that you know must be there, since that's where your app starts), searching for the exe, and writing it out to the local directory. You could also clean-up (delete) the file if you want. The classes you need are contained in standard Java (java.util.zip).
 
reply
    Bookmark Topic Watch Topic
  • New Topic