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 / December 2005

Tip: Looking for answers? Try searching our database.

How to use java to finish the following system command?

Thread view: 
Autumn-Fox - 14 Dec 2005 00:03 GMT
I want to run the system commands with java in Linux environment.
For example:
"   tar -cvf test.tar ./test/*   "

"su"

"cp src.txt tgt.txt "

etc.
tin - 14 Dec 2005 00:30 GMT
Runtime.getRuntime().exec("tar -cvf test.tar ./test/*");
BartCr - 14 Dec 2005 05:45 GMT
If you plan on using Java 5 (1.5), take a look at
java.lang.ProcessBuilder.

Bart
Autumn-Fox - 14 Dec 2005 16:27 GMT
Thank you guys very much.
Roedy Green - 14 Dec 2005 01:06 GMT
>I want to run the system commands with java in Linux environment.
>For example:
[quoted text clipped - 3 lines]
>
>"cp src.txt tgt.txt "

see http://mindprod.com/jgloss/exec.html
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

ricky.clarkson@gmail.com - 14 Dec 2005 01:46 GMT
Also see http://javafaq.mine.nu/lookup?110
Tim Terry - 14 Dec 2005 22:24 GMT
> Also see http://javafaq.mine.nu/lookup?110

You might have trouble if you need to enter a password for the 'su'
command, due to io streams from the process and the jvm. being vague as
can't really remember the specifics from a previous project.

Tim


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



©2009 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.