0

Similar question This question had an issue with filename vs classpath. I am using classpath in my program and yet was not getting the output.

I searched a lot through various posts, but I was unable to resolve my error. I have a class file in my D: The file just prints "hello world".

When I run it through command prompt as:

java -cp D:/ Test

it works fine.

But when I run the same inside a main method of another java program as:

 Process p = Runtime.getRuntime().exec("java -cp D:/ Test");

I get no output, nor errors. Can someone help me whats going wrong here?

Community
  • 1
  • 1
codingsplash
  • 4,785
  • 12
  • 51
  • 90

1 Answers1

0

You need to get InputStream out of the Process and read the input.

Ozgen
  • 1,072
  • 10
  • 19