954,510 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

cmd in java

NOTHING HAPPENS AFTER EXECUTING THIS CODE, BUT IT COMPILES AND RUNS SUCCESSFULLY

import java.io.IOException;
public class Runx
	{
		public static void main(String args[])
		   {
		     try
			{
		String x="cmd /c dir";
			  Process p=Runtime.getRuntime().exec(x);
			}
			   catch(IOException e)
				{
				   e.printStackTrace();
				}
		    }
	}


Please help.......................

arshi9464
Light Poster
44 posts since Aug 2009
Reputation Points: 8
Solved Threads: 0
 

Had similar issue few years back, you can read on it here . Advice, what other guys said there about being bad stuff to do is true. So if you let us know what you are trying to achieve we may able to help you out with more suitable solution then this one

peter_budo
Code tags enforcer
Moderator
15,436 posts since Dec 2004
Reputation Points: 2,806
Solved Threads: 902
 
mKorbel
Veteran Poster
1,141 posts since Feb 2011
Reputation Points: 480
Solved Threads: 224
 

I don't know if that works but you may want to pause and see the result.

Tellalca
Posting Whiz in Training
209 posts since Mar 2010
Reputation Points: 29
Solved Threads: 24
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: