Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Runtime exec/Java Main classloading console hijacking help

Reply
Thread Tools

Runtime exec/Java Main classloading console hijacking help

 
 
sublimate@gmail.com
Guest
Posts: n/a
 
      02-28-2007
Ok here's my problem:
I have a java program, that I don't have class to.

This java program, once started, sets up a command line for itself;
Once the command line is there, I have to give it a command to fully
start, and then i have to send it a password.

At this point it binds some ports and runs along happily.
The command line stays open in case I want give it status commands, or
check its config or any other number of admin/health check tasks.


What I want to do, is use either runexec, or exec it as a thread from
a java program to do the following:
Start it
send the second start command to the command line
send the password command to finish the start
give the command line back to the user so they can interact with it.

This is on windows btw. In fact on windows I have an intermediate
sol'n.
I setup a batch file to do a java class arguments <
file.with.start.and.password

which will start the program and pipe the commands form the file, but
then it doesn't let keyboard interaction with the command line since
its reading stdin from the file

I tried runexec to do what i wanted but I couldn't get the timeing of
the input/output/error streams to the process correct, ie waiting for
the programs command prompt to init so i could send the second start/
password, and I couldn't figure out if i could swap the intput stream
from a file to the keyboard after it was fully started.

When I load the program as a java class, and start it as a thread I
can't get access to the streams either. I thought with that setting i
might be able to do a piped stream to enable me to swap them around
but that doesn't seem like it can work either.

Thanks

 
Reply With Quote
 
 
 
 
Daniel Pitts
Guest
Posts: n/a
 
      03-01-2007
On Feb 28, 10:38 am, sublim...@gmail.com wrote:
> Ok here's my problem:
> I have a java program, that I don't have class to.
>
> This java program, once started, sets up a command line for itself;
> Once the command line is there, I have to give it a command to fully
> start, and then i have to send it a password.
>
> At this point it binds some ports and runs along happily.
> The command line stays open in case I want give it status commands, or
> check its config or any other number of admin/health check tasks.
>
> What I want to do, is use either runexec, or exec it as a thread from
> a java program to do the following:
> Start it
> send the second start command to the command line
> send the password command to finish the start
> give the command line back to the user so they can interact with it.
>
> This is on windows btw. In fact on windows I have an intermediate
> sol'n.
> I setup a batch file to do a java class arguments <
> file.with.start.and.password
>
> which will start the program and pipe the commands form the file, but
> then it doesn't let keyboard interaction with the command line since
> its reading stdin from the file
>
> I tried runexec to do what i wanted but I couldn't get the timeing of
> the input/output/error streams to the process correct, ie waiting for
> the programs command prompt to init so i could send the second start/
> password, and I couldn't figure out if i could swap the intput stream
> from a file to the keyboard after it was fully started.
>
> When I load the program as a java class, and start it as a thread I
> can't get access to the streams either. I thought with that setting i
> might be able to do a piped stream to enable me to swap them around
> but that doesn't seem like it can work either.
>
> Thanks


Look at ProcessBuilder
<http://java.sun.com/j2se/1.5.0/docs/api/java/lang/
ProcessBuilder.html>
It gives you access to the streams.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbee question. Runtime classloading Sergey Sheypak Ruby 6 02-11-2010 04:22 PM
static classloading issue... asaguden Java 2 02-17-2007 01:49 AM
Mozilla & LowerMyBills browser hijacking help ringo Firefox 5 12-13-2004 11:53 PM
Tomcat classloading Michael Mangeng Java 4 01-23-2004 07:49 AM



Advertisments