I have begun to use JDK1.2 and have noticed that the printStackTrace command no longer prints the line numbers for a java file.  It now prints "Compiled Code".

Can anyone help me with this?  I have listed the output from the Stack Trace below.

Thank you in advance.

Stack Trace = java.lang.Throwable
        at com.fmr.fiis.fts.util.Syslog.buildLogHeaderCompiled Code)
com.fmr.fiis.fts.util.Syslog.syslog(Compiled Code)
com.fmr.fiis.fts.util.Syslog.log(Compiled Code)
com.fmr.fiis.fts.util.DbConnect.printDriverInfo(Compiled Code)
com.fmr.fiis.fts.util.DbConnect.getDbConnection(Compiled Code)
com.fmr.fiis.fts.util.FtsCore.DbInit(Compiled Code)
com.fmr.fiis.fts.util.FtsCore.<init>(Compiled Code)
        at Udl3.<init>(Compiled Code)
        at Udl3.main(Compiled Code)
Who is Participating?
conickConnect With a Mentor Commented:

run the interpreter without the JIT compiler
like this:

java -Djava.compiler=NONE classname

javac -g classname

during compilation

jefftkAuthor Commented:
OK. I will give it a try.  My question is what has changed in 1.2 to cause this problem?

I have already tried your solution and it does not work.
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

jefftkAuthor Commented:
Thank you Conick!  It works fine.
I do have a question, by using that option at run time what are the drawbacks.  Does the code run more slowly?  etc...
Thanks again!

The change in 1.2 is that the JIT (Just in Time) Compiler is defaulted to be on
In 1.1 if you had a JIT compiler (i dont believe it was had to get it in a separate download) you had to specify that you were going to use it.

The JIT compiler converts the Java byte code into platform-dependent machine code so that once the app is loaded it will run faster.
So the only drawback that I can see is that it will run slower...
I only use the -D flag when debugging (and need to see the line numbers) after that there is no real reason to use the flag unless you are having problems with the JIT compiler

jefftkAuthor Commented:
The reason i need it is because i have created a Syslog class to log messages to a log.  I use the line numbers when printing the message so you can see exactly where in the program the message originated.
Do you know of a better way this can be done?  Does JDK1.2 have a feature like this ?
I dont know of any feature like that.
Although there could be one... I havent even scratched the surface
of what 1.2 can do.

You may want to catch the errors and try to use a method from the
Throwable interface (like getMessage() or toString()) to see if you
can get a String representation of the error (and grab the line numbers
from there)
Once you have a string representation you can plop that out to file

jefftkAuthor Commented:
Adjusted points to 75
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.