473,396 Members | 1,886 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Execute an exe using java code

9
Hi,

I need to execute an exe from a java application.The exe follows a partticular format when it is executed from command line. The format is as below:

( exe-name < input.txt ) > output.txt

where exe-name is the name of the exe, input.txt is a text file that contains the input to the exe, output.txt is a text file that will contain the output once the exe has executed.

I tried using the Runtime.getRuntime().exec();
But it does not seem to work.

Does anyone have a suggestion on any alternatives?
Sep 9 '08 #1
3 2898
ajos
283 100+
Hi,

I need to execute an exe from a java application.The exe follows a partticular format when it is executed from command line. The format is as below:

( exe-name < input.txt ) > output.txt

where exe-name is the name of the exe, input.txt is a text file that contains the input to the exe, output.txt is a text file that will contain the output once the exe has executed.

I tried using the Runtime.getRuntime().exec();
But it does not seem to work.

Does anyone have a suggestion on any alternatives?
Did you read this article? JavaWorld
Sep 9 '08 #2
Nepomuk
3,112 Expert 2GB
...I tried using the Runtime.getRuntime().exec();
But it does not seem to work...
What exactly didn't work? Things can go wrong with Runtime.getRuntime().exec(), but that doesn't mean you should be looking for an alternative. Please post relevant code and we'll help you fix it.

Greetings,
Nepomuk
Sep 9 '08 #3
rajujrk
107 100+
Use ProcessBuilder class

Its a excellent one..

U can execute not only exe files, also execute all files..

for example execute the follwing with its appropriate applications

demo.txt - notepad

demo.doc - word

try this and say..
Sep 9 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Cyrus Lan | last post by:
I have a jar file, without source code, say abc.jar. I have set it in the CLASSPATH The main execute class in abc.jar is a.class. In the command prompt, I can execute the program by issuing...
13
by: BlackHawke | last post by:
Our program, game program Andromeda Online (www.andromedaonline.net) uses two programs- one to play the game, another to patch the game as updates come out. Players actually launch the updater...
0
by: John Doe | last post by:
Hello, I'm currently working on a little tool that would benefit from having a little embedded script language. Although I have C++ source code available for such a script language, I have 2...
6
by: Doohan W. | last post by:
Hi, I'm now working with DB2, and I can't find out how to execute the contents of a string Statement, without using a Java/... procedure, only using SQL statements. I know that some SQBDs such...
14
by: technocrat | last post by:
db2 -t -v -f/home.../filename >output_file-name I have a java stored procedure..which has to run the above command...not sure how i can run this command through java.. any suggestions are...
0
by: dappyl | last post by:
Hi,... I have an example shell script to run command prompt. It works fine.. the code shown below : <% Dim wshell, intReturn set wshell = server.createobject("wscript.shell") intReturn...
2
Saghar
by: Saghar | last post by:
Hi, Could somebody help me about this topic? I want to know how we can call and execute a non-java source file in a java application. For example, a simple Java application is run, there is an...
1
by: byjufromgamut | last post by:
I created a batch file, when executes gives a preview window(using swings & JFrame). I created another java fie in which used a Process object and Runtime.getRuntime().exec(path) , where path...
6
by: moongeegee | last post by:
I have compile my java program as myjava.class. And I can run as "java myjava" without any program. As now, I need to execute myjava.class in javascript. Please shed a light how to execut "java...
5
by: sayeo87 | last post by:
Hi, I am quite new to JSP so please forgive me if I ask really simple things... I am trying to run system commands on the server and display the output on a webpage. This is what I've got: <%@...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.