Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2007

Tip: Looking for answers? Try searching our database.

Runtime exec/Java Main classloading console hijacking help

Thread view: 
sublimate@gmail.com - 28 Feb 2007 18:38 GMT
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
Daniel Pitts - 01 Mar 2007 01:36 GMT
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.
[quoted text clipped - 35 lines]
>
> 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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.