• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Java Command problem

 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That fixes one of the two compile errors.
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 1638
IntelliJ IDE MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic