Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Output commands to the System

Posted on 2003-02-21
Medium Priority
Last Modified: 2010-03-31
Hi, i'm just starting out with java,

            Is there a way to output commands to the Terminal window (for UNIX) or to MSDOS prompt (for using windows) from within a java program ?
i talking about commands like :
"cd Java/Programs"
"javac HelloWorld.java"
Question by:4mod3
LVL 18

Expert Comment

ID: 7995485

Accepted Solution

vamshicheruku earned 150 total points
ID: 7995541

String cmd="cd Java/Programs";
Runtime r = Runtime.getRuntime().exec(cmd);


Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses
Course of the Month15 days, 15 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question