Computing.Net > Forums > Programming > call unix commands through program

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

call unix commands through program

Reply to Message Icon

Name: era
Date: January 7, 2004 at 10:44:52 Pacific
OS: ScoUnix,windows
CPU/Ram: 128
Comment:

hi all,
Can we call(run) unix commands through a java program? Plzz let me know....
Actually i want the commands like "ls" to run automatically when some event occurs & then i want to store its output in a file by redirecting it.

if anybody knows the solution or link...plzz tell me..waiting 4 ur reply.



Sponsored Link
Ads by Google

Response Number 1
Name: wt (by think)
Date: January 7, 2004 at 18:31:35 Pacific
Reply:

yes. In C, function "system" will do, in Java, I can't remember which class it is, try searching the java official website.

hope that help. :)

wtk


0

Response Number 2
Name: anonproxy
Date: January 7, 2004 at 21:02:41 Pacific
Reply:

This is found in the runtime object (specifically, Runtime.getRuntime()). This makes your code system dependent.

Example here. Spend 60 seconds reading about the Runtime object. It should be easier to find, but the majority of the class goes against the preachings of portability. Well, its not Sunday ;)



0

Response Number 3
Name: era
Date: January 8, 2004 at 07:27:29 Pacific
Reply:

hi,

Thanx a lot to wtk & anonproxy
for replying me.
I am now trying to execute the commands
using information given by u both.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: call unix commands through program

Calling Unix commands in C? www.computing.net/answers/programming/calling-unix-commands-in-c/3049.html

connecting to unix using vb 6.0 www.computing.net/answers/programming/connecting-to-unix-using-vb-60/7085.html

HOW CAN I RUN UNIX COMMANDS in VB6? www.computing.net/answers/programming/how-can-i-run-unix-commands-in-vb6/14264.html