• Post Reply Bookmark Topic Watch Topic
  • New Topic

Running an exe on click of a button packaged as a resource in the jar

 
Neeta Bharadwaj
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

So this is my package structure:
  • Project
    • src
      • com.mypackage
        • MyClass.java

    • resources
      • icon.png
      • myexe.exe

Right now I have to run the exe like this : - It has hardcoded the path of the exe :
This works fine. But, When I package it as a jar I want to give a relative path to my resources folder. How can I make this happen?

I tried:
but this "path" did not work.

Another way would be to extract the exe to a local path on the server, but there is a possibility that I could face permission issues.

Please advise. Any help is appreciated.
 
Stephan van Hulst
Bartender
Posts: 6583
84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't do this. You will have to have the exe somewhere on disk before you can run it. You could create a temporary .exe file and transfer the resource executable's bytes to it before running cmd on the new temporary exe.

Why do you want to do this?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!