Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In eclipse, how can I see where the java classes are loaded from?

My problem is as follow : I am developing an eclipse plugin and sometimes I lose track of where the classes are loaded from. What I would like is to see in the debugger stacktrace where a class is loaded from (which jar on the harddrive).

Am I missing some obvious Eclipse option ?

Any help would be greatly appreciated !

like image 978
vpi Avatar asked Sep 06 '11 07:09

vpi


People also ask

How do you find where a class is called in Eclipse?

In Eclipse IDE, you can type CTRL + SHIFT + T in Windows or *nix or Command + SHIFT + T in Mac OSX to prompt an Open Type dialog box to find details about a specified Java class.

How can I view the source code of a class file in Eclipse?

Go to the Package Explorer view with the file open in the current editor. Click the "Link with Editor" toggle (the two arrows). This should jump you to the class file you are viewing, which should be in the jar you are using. If the jar is in a library, you should see the path to the jar in the package explorer.

Where are Eclipse classes stored?

Put the compiled class into WEB-INF/classes. Usually eclipse does this for you. If you go to the eclipse build path (right click properties on your project -> build path) and then select 'source', it should show an output folder.

How are classes loaded by JVM?

In order to actually load a class, the JVM uses Classloader objects. Every already loaded class contains a reference to its class loader, and that class loader is used to load all the classes referenced from that class.


1 Answers

To see location of classes loaded : In Run configurations -> Arguments tab add vm argument -verbose. That will include the full path of classes loaded.

EDIT: To find a particular class from a list of jars:

I use a jar class finder plugin. I do not recall the exact location from where i downloaded, the alphaworks link seems broken as of now. But you can find similar tools.

Note : In eclipse, if the console fills up to a point you are not able to see previous logs, then in Common tab -> Standard I/O check File option.

like image 150
Rajeev Sreedharan Avatar answered Sep 28 '22 12:09

Rajeev Sreedharan