Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specifying Source for Debugging using Netbeans

Tags:

jsf

netbeans

Using the debugger in Netbeans 6.1, I'd like to step into a method of the JSF library (specifically method saveSerializedView of class StateManager), but I cannot figure out how to specify through the IDE the location of the source code for the JSF library. I'm even having trouble determining which jar file or files Netbeans is using for JSF.

like image 479
user14636 Avatar asked Sep 17 '08 20:09

user14636


People also ask

How can I view Source code in NetBeans?

Right click, and from the context menu select Navigate > Go to Source and you should be redirected to the appropriate position within the source of the JDK class. Alternatively, press Ctrl + Shift + B.

What does debugging mean in NetBeans?

NetBeans, like most other programming environments, provides a particular tool for this called a debugger. Debugging can be defined as the process used for examining the code for errors. Debugging is carried out by setting breakpoints in code and then using debugger to run it.


3 Answers

This answer applies to Netbeans 6.1 circa September 2008:

It sounds as if you need to explore the "Libraries" dialog. Select "Tools" from the menu bar and "Libraries" from the menu. If you select "JSF" on the left, you'll see an association of jar files, sources (currently none in my Netbeans 6.1) and javadoc (which shows javaee5-doc-api.zip in my Netbeans).

What you need to do is add a new zip or jar of source files under the "Sources" tag.

An example of a fully populated library is the "Swing Layout Extensions" which has a jar file, sources and javadoc.

like image 123
Bob Cross Avatar answered Oct 17 '22 12:10

Bob Cross


I take it your jars don't include the source, since you can't "step into." In cases like these what I do is find the appropriate source (just StateManager.java in this case, if it's available, or jars that include source), taking care that it is the version I'm using. Inside my project tree, I create the package hierarchy to that specific class, and put that source in there. Even if the class exists in a jar, I can use this source to set breakpoints, etc.

like image 1
Germán Avatar answered Oct 17 '22 13:10

Germán


Example for Netbeans7 and Mojarra 2.0.3
Create a new library(Tools->Libraries), call it for example Mojarra-2.0.3.
In the classpath tab add the 2 mojarra jars:

  • jsf-api.jar
  • jsf-impl.jar

In the sources tab, add two paths:

  • ..\mojarra-2.0.3-FCS-source\jsf-api\src\main\java\

  • ..\mojarra-2.0.3-FCS-source\jsf-ri\src\main\java\ Add the new created library to the project

like image 1
Dumitru Avatar answered Oct 17 '22 13:10

Dumitru