• Post Reply Bookmark Topic Watch Topic
  • New Topic

Cannot execute external executable  RSS feed

 
John Pauls
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, basically, this is my structure folder:
app.jar
appfolder
|
\__program.exe (inside appfolder)

In my code, i try to launch this exe like this:



with Resources.APPFOLDER having the value of "appfolder". But, no matter how hard i try, or many combinations i use, it throws me this exception:

java.io.IOException: Cannot run program "program.exe" (in directory "appfolder"): CreateProcess error=2, The system cannot find the file specified

I have tried executing other file, but it throws me the same message. I dont know what i am missing here. It just does not work. The last message was thrown running the app from eclipse, but EVEN with the code exported to a jar, it gives me the same result. What can i do?
 
Paul Clapham
Sheriff
Posts: 22832
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The message is pretty specific -- it can't find the executable in the folder you specified. I'll also note that the message refers to a relative path rather than an absolute path, and so does all of your post. I'd suggest just specifying the absolute path to the folder where the executable is located instead of assuming the relative path you provide is relative to some folder you had in mind.

And, welcome to the Ranch!
 
John Pauls
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul! The problem is, how can i know the absolute path without knowing where the jar is going to be executed? Should i get somehow the path where jar is?
 
John Pauls
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, should i explain, those folders are created by the jar (the exe in this case is being downloaded too, all working).
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!