Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
157 views
in Technique[技术] by (71.8m points)

java - How can I check on debug symbol status with Eclipse?

While discussing another question I asked, @Aaron Digulla pointed out the following:

If you installed the Java SDK, there should be a "src.zip" file in the root directory of the Java installation. If it's missing, download Java again. Eclipse should find the source automatically and show it to you when you open the type JTable (or when you click on the line in the stack trace).

The file src.zip is present for me, but I still can't access the source of JTable like @Aaron said. What could be the problem? How can I solve this with Eclipse?

The "Unknown Source" worries me, though. it means your version of Java doesn't have debug symbols. Make sure that you a) use a SDK while developing, b) that your SDK contains debug symbols, c) don't tell the command java to strip debug symbols when it loads classes.

a) I'm using Eclipse, why shouldn't I being using SDK?

b) How do I know if my SDK contains debug symbols? And if it doesn't, how can I add them?

c) How can I check if Eclipse is telling java to strip debug symbols?

Sorry for these banal questions, but I feel like I don't fully understand the Java development process.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

a) Eclipse comes with it's own Java compiler, so if you are using the Java Runtime Environment, you won't run into many issues, except that extras like jarsigner and possibly the JRE source code may be missing. The best way to verify your installation is through your package manager; however, if you installed by some other means, careful directory observation can usually differentiate the two (see below).

b) JRE libraries are typically compiled without debugging symbols present. SDK libraries typically have them. Java debugging is done by starting the JVM with command line options which open a debugging port. The SDK talks to the JVM requesting breakpoints be set through this port. Later if you decide to step the JVM, it also sends the step / jump / rewind debugging commands through this port. The "debugging" symbols are actually JVM bytecode tables, which reference which line of source code is in effect starting at a particular bytecode instruction. This allows debuggers to associate the running bytecodes with line numbers in the original source code.

c) Verify it by (from the menu) Window->Preferences (on the selector column) expand "Java", expand "Build Path" under "Java", and select "ClassPath variables". You will see a few variables, including one called "JRE_SRC", which should point to the src.zip file containing the public facing JRE library source code. It is a good idea to verify JRE_LIB at the same time.

A JDK home directory typically contains a "bin" sub-directory and a "jre" sub-directory, so if you only see a "bin" sub-directory, odds are good you are in a JRE home directory. With this knowledge, hopefully you'll be able to figure the rest out.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...