Get the Type of Exception JVM

C

CezarAntonio

Hi, i'm a brazilian student.
I'm need, in my student project, capture the type of Exception
throwable for JVM.
For example :

if when compiling any source,
the jvm to return that "a signal ; it is required " or outher comum
error,
i'm need to identify this error and save in table of mysql.

I'm use Runtime.exec , i'm use the code the Michel Daconta em your
article:
http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
for capture the text message throwable for JVM , but i'm liked to
know if exist outher way to identify the error.

Sorry for my language.

Cézar
 
T

Tim Hemig

CezarAntonio said:
Hi, i'm a brazilian student.
I'm need, in my student project, capture the type of Exception
throwable for JVM.
For example :

if when compiling any source,
the jvm to return that "a signal ; it is required " or outher comum
error,
i'm need to identify this error and save in table of mysql.

If you mean the errors from the compiler while compiling the source, that
are no exceptions like the thrown Exception while the runtime of your
compiled programm itself.

for compiler errors I see no other way than parsing the output with the help
of another programm, or cunsulting the dokumentation of javac, perhaps the
compiler has some more machine-readable output.

for Exeptions in runtime you just have to catch the Events, ask with the
help of 'if(var instanceof Class)' for the Type and write a method, that
puts Exceptions into a Database. Bu be carefull with writing into the
database - an Exception, that should be written into the database could
cause more Exceptions and so on, leading to an infinite recursion.

Hope i got the right opinion of your problem so far,

Tim
 
G

Greg R. Broderick

Hi, i'm a brazilian student.
I'm need, in my student project, capture the type of Exception
throwable for JVM.
For example :

if when compiling any source,
the jvm to return that "a signal ; it is required " or outher comum
error,
i'm need to identify this error and save in table of mysql.

Exception (and its subclasses) is just another Class in Java, so you can do
instance.getClass() to get the specific subclass of exception that has been
thrown, within a try/catch block.

Cheers!

--
---------------------------------------------------------------------
Greg R. Broderick (e-mail address removed)

A. Top posters.
Q. What is the most annoying thing on Usenet?
---------------------------------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,240
Members
46,830
Latest member
HeleneMull

Latest Threads

Top