• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Command problem

 
Amir Iqbal
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi everyone .

i am facing a strange problem basically i want to redirect output "JAVA MYCLASS"
command to my specific file.

Description :

Actually i want to redirect the output of "JAVA MYCLASS" command.
where the MYCLASS would be the name of the compiled class at specific
location.
i tried following but got no output


but at the end the output.txt is empty

please help me

waiting for your suggestion

regards
Amir Iqbal

JCE: Please use Code Tags - they preserve your code format and make reading easier.
[ August 14, 2008: Message edited by: Joe Ess ]
 
Joe Ess
Bartender
Pie
Posts: 9266
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your code does not compile:


Please Post Real Code.
 
Amir Iqbal
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok so please omitt that line with

System.out.println("..............");
or
basically it is a static method in ExecuterClass
********************************
ExecuterClass.show(String str,boolean b){

if (b == true)
System.out.println(str);
}
 
Joe Ess
Bartender
Pie
Posts: 9266
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That fixes one of the two compile errors.
 
Abhijeet Nalawade
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fail to understand what is to be achieved. Explain it bit more clearly.
 
Amir Iqbal
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
just comment that line..... yar it will fix all the errors... coz it is just a debugging statment....
 
Joe Ess
Bartender
Pie
Posts: 9266
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you going to fix the error on line 76?
Please Show Some Effort. I'm getting the impression that you just want us to do your work for you.
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Amir Iqbal:
just comment that line..... yar it will fix all the errors... coz it is just a debugging statment....


Joe's intention was not for him to fix your code but to make you realise the importance of Posting real code.
Anyone over here can fix your code of compilation error but the point is that you must post your question clearly.
It wastes the time of the people trying to help you if your code has compilation errors.

The other compilation error Joe is talking about isnt a debug statement, but it is the core of your program execution, you are calling when is not defined.

ExecuterClass2.java:76: cannot find symbol
symbol : variable cmd
location: class ExecuterClass2
Process proc = rt.exec(cmd);
^


BTW, this code is directly out of this article
If you are having problems understanding some article or sample code, then please QuoteYourSources
[ August 18, 2008: Message edited by: Nitesh Kant ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic