• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to pass parameters to exe, executed using java code

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator



My target is to run external exe file throught java programm and communicate with it.
i am able to get the out put of exe but faceing problem with blocking calls.. i will explain:

For example

if i want to get out put of c program i.e. test.exe ( it will print hi on console if we run this file directly)

then by using following code




I get out put as
hi

on java console

but if a c program has bloaking call in it
for example let test.c contains a code




now when i run executable file of above program(test.exe) using java code given above it will goes in
infinite waitting state.
i think the reasone is text.exe wait for user to give input but in this case user is a java program who
dont have any idea about that so process goes into infinite waitting condition..


So My question is

>>>>>>>>>>>>> WHAT TO DO ???

i want java program to print " Enter number = "
then user will give number
the number given by user to java program should be passed to
test.exe
and final out put "You entertd =(number given by user) " should be printed on screen





 
Rancher
Posts: 1337
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The first thing to do is to cut way down on the number of smilies you use in your posts.
 
Marshal
Posts: 79239
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

Lester Burnham has a good point.

Please search this forum and "Beginning Java" because several other people are asking very similar questions just now.
 
Rocky Roy
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
all the post i gone through
are just doing one way communication with process
but what i want to do is to create java wrapper to execute c program exe


for example :

Wneh program will print
Enter The Number :
i will display this message in jave frame.
and ask for input from user and pass the same to c program exe process.

and again get what ever the feedback of program to the java frame;

so it is a kind of 2 way communication with process
by handling
stdin,stdout,stderr and what ever...
 
Rocky Roy
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Welcome to the Ranch

Lester Burnham has a good point.

Please search this forum and "Beginning Java" because several other people are asking very similar questions just now.




>>>>>>>>>>>>

all the post i gone through
are just doing one way communication with process
but what i want to do is to create java wrapper to execute c program exe


for example :

Wneh program will print
Enter The Number :
i will display this message in jave frame.
and ask for input from user and pass the same to c program exe process.

and again get what ever the feedback of program to the java frame;

so it is a kind of 2 way communication with process
by handling
stdin,stdout,stderr and what ever...
 
Rocky Roy
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please help me with above issue

i tried search many time but still no answer found
 
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're Java program needs to read data from p.getInputStream(), then recognize when to send data to p.getOutputStream(). Unless you can tell it what data read requires what data to be sent this is not going to be easy.
 
Rocky Roy
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes you r very right...

this is the point where i am blocked in process ...
 
My previous laptop never exploded like that. Read this tiny ad while I sweep up the shards.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic