Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

java syntax to call system commands?  RSS feed

 
Carlos Spencer
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you call system commands from a java program? If so, how?
For example, I want to write a simple program that tells me the time or date or even untar a file. It just never occured to me of doing that stuff before on Java.
My system is linux 2.4.22 using BASH shell.
 
Brian R. Wainwright
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
Take a look at the java.lang.Runtime class. It has methods for doing this stuff.
---BW
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!