Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Beginning Java
Search Coderanch
Advance search
Google search
Register / Login
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
paul wheaton
Liutauras Vilda
Ron McLeod
Sheriffs:
Jeanne Boyarsky
Devaka Cooray
Paul Clapham
Saloon Keepers:
Scott Selikoff
Tim Holloway
Piet Souris
Mikalai Zaikin
Frits Walraven
Bartenders:
Stephan van Hulst
Carey Brown
Forum:
Beginning Java
Exceptions & Error
MRaj Kumar
Greenhorn
Posts: 2
posted 23 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I want to copy all the Errors and Exceptions of Compile time and Run time into a text file.
How do I do it. Kindly send the program if possible or at least the approach.
Urgent!!!
Val Dra
Ranch Hand
Posts: 439
posted 23 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
This will output exception to a file
import java.io.*; public class ErrorToFile { public static void main(String args[]) { try { Runtime r = Runtime.getRuntime(); Process p = r.exec("javac classfile.java"); InputStream in= p.getErrorStream(); BufferedReader br = new BufferedReader(new InputStreamReader(in)); FileOutputStream out = new FileOutputStream ("c:/Exception.txt"); PrintWriter pw = new PrintWriter(out,true); while ( true ) { String str = br.readLine(); if ( str == null ) break; pw.println(str); } }catch ( Exception ee) { ee.printStackTrace(); } } }
Val SCJP <BR>going for SCJD
Why fit in when you were born to stand out? - Seuss. Tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Is there compile time exceptions in java?
How RuntimeException is unchecked while Exception is checked?
Exceptions
how to tell whether the exception is a checked exception
difference beteween checked and unchecked exception
More...