Dear All How can i run an EXE file from a JAR application i am using the following code, but it is not working. please help Process Process; process =Runtime.getRuntime().exec("Native.exe"); before making a JAR it was working, but from inside the jar i am not able to call this Native.exe file please help
Govind, The .exe needs to be in the path for the OS to find it. Also, welcome to JavaRanch!! Please change your name to be compliant with JavaRanch's naming policy. It should not be obviously fictitious. Your displayed name should be 2 separate names with more than 1 letter each. We really would prefer that you use your REAL name. You can change your name: here. Thanks, Cindy
"JavaRanch, where the deer and the Certified play" - David O'Meara
Thanks for changing your name. I am kinda swamped right now, but when you ask the operating system to execute a program, such as Native.exe it starts searching for that program following the directories that are named it the os's path parameter. This is different from the classpath that the JVM uses to search for class files. Your choices are to - modify the path that the user has on their machine (perhaps by dynamically concatenating onto the existing path in a bat or sh file) - or you can name the full path for finding the Native.exe program - you could try to get the user to put that .exe file someplace and track where they put it In any case, once you start doing any of these you start making the solution dependant on the operating system. But then when you created the Native.exe program you must have compiled it for only one specific operating system anyway.
"JavaRanch, where the deer and the Certified play" - David O'Meara
Can you shoot lasers out of your eyes? Don't look at this tiny ad:
Gift giving made easy with the permaculture playing cards