Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Running a .exe file from a .java file

 
abinash das
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a scenario like i am having a executable jar file
,i converted it into .exe file .

My requirements.
1:-- To Run that .exe file from a .java file.
2:-- send some values to that .exe file which it will take as
an parameter.

Thanks in advance
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at the java.lang.Runtime.exec() family of static methods.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or the ProcessBuilder class if you're running Java 1.5 or later.
 
abinash das
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can Any Body send me some codings.
I don't want to hard code my .exe file location inside
exec(-) method.
and more over i want to pass pass some parameters to that .exe file.
can any body suggest me a sample code.


thanks in adv.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Javadoc for ProcessBuilder has an example
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic