I am taking AP Computer Science and my teacher requires JavaDocs. I was wondering if there is a way to make sure that none are missing. I am using Netbeans for the class but I'm sure that others would like to know if it exists for other IDEs too. Also, is there a way to automatically add empty JavaDocs? Thanks for all the help.
You can generate them automatically in Eclipse using a plugin called JAutoDoc. Netbeans 4.0 and up has a feature called Auto Comment which formats your comments to be Javadoc-compliant and also flags up any that are missing, so this appears to be what you're after.
Check out https://netbeans.org/competition/win-with-netbeans/auto-comment.html for details, but the gist is that you select "Auto Comment" from the tools menu.
You are looking for checkstyle plugin that will show you warning in situation when there is no javadoc for method.
In NetBeans, select your project in the Projects window, then select the "Analyze Javadoc" item from the "Tools" menu. This will produce a report detailing missing or faulty (e.g. missing parameters) Javadoc within the project. I've tested this feature personally in Netbeans 10.0, but I believe it's been there since at least version 8.1.
As an alternative to selecting your entire project in the Projects window, you can also select subgroups of packages or classes to check. This is particularly useful if you're not interested in adding Javadoc to your unit tests: you can just select "Source Packages" and run "Analyze Javadoc" on them without producing warnings about classes in the "Test Packages" group.
Related
I have many missing libraries in a Java Eclipse (3.7.2) project. Is there any way of copying the list of libraries, to paste into a document for editing?
You can select the errors in the "Problems View" and copy them. Eclipse will put a pure-text version into your clipboard which you can then paste into an Editor.
If you have a working project and want to copy libraries from there, open the (hidden) .classpath file. It's XML which you can copy&paste. I haven't tried copy&paste from the "Build Path" dialog but maybe that works as well.
While Eclipse may recognizes compile-time required dependencies that are missing i hardly doubt it knows runtime-required librarys (so no, eclipse and as faar as i know any other IDE does not support that unless dependency management is set up with for example Maven).
The librarys missed at compile time should show in the 'Problems' view of Eclipse.
Window -> Show View -> "Problems" (select view 'Problems')
Once you have a tab with that view you can order the problems by its description and all of the 'missing library..." issues will be listed in a group. You will then be able to select according entrys and CTRL+C / CTRL+V them out of there.
Also note that in my case using maven eclipse oftenly thinks there are classes or dependencys missing by the fact eclipse is not that skilled when it comes to local synchronization of your workspace.
Id rather invest that time to start adding missing dependencys or think about Maven for more proffessional dependency management.
When I try to add a Java Exception Breakpoint, I get a blank white screen with no "Matching items:" At the bottom I don't have a package symbol. Is there any way I can configure Eclipse so I can add a breakpoint corresponding to a Java Exception? I am remote debugging.
I have experienced the same behaviour. The build works otherwise fine, and JDK is in the build path. Eclipse Kepler SR 1, Windows 7.
For me, the dialog started to work when I went to Run -> Debug Configurations -> [my debug configuration] -> source tab and added [myjdkpath]/jre/lib/rt.jar there manually. After doing that, the other exceptions appeared as well.
When I removed it again after adding, I was still able to see all my exceptions like supposed to. I guess you can just add any library there, debug, and remove it for Eclipse to "refresh" itself.
For me the cause was that the nature of the project the .target file resided in lacked a Java nature, that is it was just a 'Generic' project.
Open the normally hidden .project file and modify the <natures> section by adding the java nature as in the snippet below then re-open your project.
...
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
...
When I open up the "Add Java Exception breakpoint" dialog window, there is already "Exception" displayed in the input field and all exceptions eclipse knows are listed.
You should type in the name of the exception into the input field. If you don't know the exact name you should write lower-case and you can use "*" as a wildcard.
Then the types matching that name should occur in the list and you can choose them for your breakpoints.
Be aware that these special breakpoints may slow down the debugged process signifiantly. So don't forget to remove them after debugging. This is a lesson I learned the hard way. ;)
I had this problem with Eclipse Neon and JDK 1.8u131. I had created a new workspace and imported only Maven projects. When I tried to add an exception breakpoint, the Matching items area were blank.
The currently accepted answer of "adding the JDK's rt.jar" did not fix the problem for me.
What did work is the following:
Find a "runnable" Java class in one of the imported Maven projects; runnable meaning: a class with a main() method.
Right-click on the "runnable" class
From the right-click menu, select Run As->Java Application.
Eclipse kicks off an index operation.
Click on the Debug perspective and click on the Breakpoints view's Add Java Exception Breakpoint toolbar icon.
Eclipse displays exceptions in the Matching items area populated normally.
The specific version of Eclipse on which I had this problem is:
Eclipse Java EE IDE for Web Developers.
Version: Neon.2 Release (4.6.2)
Build id: 20161208-0600
Windows 10 64-bit anniversary update
All I want is for JavaEE6 documentation to show in my JavaSE project. Maybe it's not possible.
The problem is that I created a plain old JavaSE project (i.e. New Project -> Java -> 'Java Application') in NetBeans but I have Java Enterprise Edition elements in it.
One of these elements is the javax.persistence #Basic(fetch/optional) annotation.
- When I press ctrl+space on this annotation, NetBeans says 'Javadoc not found.'. When I use Alt+F1 (Right-Click->'Show Javadoc'), the status bar says: 'Cannot perform Show Javadoc here.'.
Extra info:
1) netbeans_installation_dir\NetBeans 7.0.1\enterprise\docs contains the right API documentation zip file (javaee6-doc-api.zip).
2) I looked around on stackoverflow for similar solutions but they did not work for me - adding the .jar/.zip/folder to the library or via the 'Tools -> Java Platforms -> Javadoc tab' doesn't work neither.
Very strangely enough when I add the javaEE6.jar to the Javadoc tab of the JDK6 platform and in the Project structure window I right click on the 'JDK1.6' library with 'Show Javadoc', a browser window opens and I get to see JEE6 documentation like I wanted.
I'm guessing the problem is that I have a regular JavaSE project and NetBeans can't pick up the JavaEE6 javadoc because it doesn't know my app is partially using EE elements. It's probably also because that documentation is meant for JavaEE6 applications (that's why it's under the /enterprise folder).
So I don't know how to fix this. Is it a bug? (I read on a NetBeans bug report that this could be a possible bug).
This looks like to be a issue with how you are attaching the library to you project. The easiest way to do this, is using the libraries available at Tools > Libraries. You just need to make sure the library you are attaching to your project has the correct Javadoc attached too. If the Javadoc is not attached, you can try the following steps to do this:
In the NetBeans IDE, go to "Tools > Libraries".
Select the correct library and choose the Javadoc tab.
Click "Add ZIP/Folder" and browse to where your project Javadoc is located.
Specify the Javadoc ZIP or folder and click "Add ZIP/Folder".
Click "OK" to close the Library Manager.
More details can be found at [this NetBeans Wiki page][1].
I have setup a dynamic web project in eclipse with JSF in which I trust on code from another project (framework). Therefore, I added the framework project to the build path of the website project.
So far so good, Eclipse recognises every class and the project builds without errors.
Problem is though that when I do "run on server" to test it on tomcat 6.0.24, the application fails. I get ClassNotFoundException on every class from the framework project.
Is this a bug or is some specific configuration necessary for this?
I was googling and ended up here for a similar problem. I wanted to make a note for others about the current situation on Eclipse Indigo, as the terminology has changed a bit by the looks of things.
On your project properties, do a filter/search for "deployment assembly".
It is then straightforward to add a project dependency. Job Done.
Thanks to Alexander's edited answer which led me to this.
Did you check Warnings in Problems view?
Do you see Classpath entry /your/framework.jar will not be exported or published. Runtime ClassNotFoundExceptions may result warning?
If you do.
Right-Click the warning and choose Quick Fix.
Choose "Mark the associated entry as publish/export dependency." from Select a Fix box.
Click Finish.
EDIT
Now, I think I understand where disconnect is. I think now I remember the joy of figuring this out for the first time.
In your website project ( I will speculate here , but I guess you've created it as a Dynamic Web Project ):
Open project properties
Select Java EE Module Dependencies panel
Check your framework project in JAR/Module column. Beware, that for reasons not known to me, the list is not sorted ( and is not sortable ) in any particular order, so you may need to search for your project reference there.
The results of this operation will be written to /website-project/.settings/org.eclipse.wst.common.component file. Put this file into your source control.
I'm developing various in-house extensions for JIRA, the issue tracker we use. So far I worked with Netbeans and everything worked like a charm. However, now I need to switch to Eclipse and I'm having struggle setting up the environment for this development project.
First a clarification why I'm using the approach I'm describing here: building JIRA (in an IDE) is not easily done and I'm absolutely not interested in wasting my time to figure out how to do it. Besides, I don't need to build it, I just want to develop extensions and be able to use the IDE's auto-completion and help support (API docs). Atlassian (the company that develops JIRA) provides a "development" package, but it's just a sorry excuse rather than a real solution.
What I did with Netbeans was to create a library bundle with all relevant jar-files, the Java source files and the API documentation. This way I could use auto-completion, "jump to" the source and the API docs would pop-up when needed.
It seems Eclipse doesn't offer such a functionality, at least I couldn't figure out how to add the sources and the API docs to a "User Library" (which I'd then add as a dependency to my project just as with Netbeans).
My next approach was to create a separate project that holds all the stuff and mark that project as a dependency of my project. This works, but it leaves me with another issue: now I get 37k errors reported (all within the "dependency project"). As said, correctly setting up building for this dependency is a major struggle and not my original goal, therefore I'd happily ignore these errors. Automatic building is turned off and changing the "Errors/Warnings" settings under "Java Compiler" for the project didn't change a thing, so I'm kind of lost now.
Okay, let me try to phrase this as questions:
Maybe I just didn't find it: Is there a way to create a dependency bundle (call it whatever you want) in Eclipse that -- besides just carrying jar-files -- gives me the ability to use the API docs and "jump to" the declaration in the sources?
If not, what's the common practice to do in such a situation?
If the "dependency project" solution is the way to go, how can I completely disable compiler errors for that project?
Check this for illustration with images
Add the source code for jar
Add the Javadoc for a jar
Or just right-click on the jar file in the Package Explorer view. Select "Properties" then set the according paths in the "Java Source Attachment" and the "Javadoc Location" field.
When you create user libs via window->preferences->java-build path->user libraries you can specify which jar you need, sources (in archive or folder) && javadoc (from internet, or local, or from archive). Then you can use this lib in your project via context menu on project->Build path->add library->user library-> choose your lib.
Here you acn pick up more info Eclipse help