I'm working on big Java enterpriseware (MatrixOne / ENOVIA V6, if you mind). The maintainers provide some kind of Javadoc, which looks like very vanilla Javadoc, and I can read it as HTML in my browser.
However, I'm unable to integrate it to Eclipse, which is painful because I have to make round-trips to my browser. In Eclipse, I just get the dreaded Note: This element neither has attached source nor attached Javadoc and hence no Javadoc could be found.:
After learning that Javadoc can be defined at project and .jar level, I tried to do both, knowing that:
the javadoc folder contains a package-list file, which seems to sanely define the documented packages
the javadoc folder contains the typical folder/subfolder package structure, itself containing ClassName.html files. E.g. the com.matrixone.apps.domain line of my package-list file is matched by a com/matrixone/apps/domain structure, containing lots of ClassName.html files
the javadoc folder doesn't contain a index.html file
When I try to define my Javadoc, the Validate... button fails because of a missing index.html. Then if I create a dummy index.html file, validation works, but I still cannot see the Javadoc when hovering a vendor class/method.
So my question is: What's missing to get this skewed Javadoc to display in Eclipse? Sub-questions I see at this point are:
Was it a bad idea to create a dummy index.html file? If yes, what should I do? (i.e. what tags/meta-information does Eclipse expect?)
A quick comparison of a standard Javadoc file (String.html) vs. one of those vendor Javadoc (DomainObject.html) reveals that meta-information possibly used by Eclipse is absent from my javadoc. For example, my vendor Javadoc includes none of the many <meta> tags present in the String.html Javadoc <head>.
→ Does somebody know the logic/heuristic used by Eclipse to fetch a method/class Javadoc? Maybe point me to the code? With this information I may be able to figure out what's wrong in my Javadoc, and hopefully fix it.
Anything you see fit if you ever faced a similar problem.
I'm currently using Eclipse Juno SR1 on Java 7, under Windows 7.
Of course, feel free to comment to ask for information I forgot to include. Thanks for your help!
I had a similar problem; however, I didn't try to solve it by using a local copy of the JavaDoc for JDOM. Instead, I was trying to use the appropriate URL (the JavaDoc URL for the current version of JDOM is http://jdom.org/docs/apidocs/). So, on the jdom.jar library in the Java Build Path configuration for my Eclipse project, I configured the URL and hit the Validate button. Eclipse seemed to think it was valid, but I still got the same error about not having any attached JavaDoc.
I then discovered that jdom.org also has the JavaDoc for an older version of JDOM (http://www.jdom.org/docs/apidocs.1.1/). So, I tried that on the jdom.jar library JavaDoc configuration and that worked!
The lesson I learned was that the version of the library appears to be taken into consideration when Eclipse is deciding whether the configured JavaDoc is utilized (considered to be attached or not). Make sure the library version matches the version of the JavaDoc for the library (seems obvious now that I've found it).
Hope this helps.
Related
Before you close this question as a duplicate: I am very well aware of answers like this.
However, the Quick Doc only provides the type information, like Class and so on.
This is because the jars we have no JavaDoc in them (When I Ctrl + B into them they don't have any JavaDoc).
With jars, I don't mean some internal ones, but rather Objects like String or List, which would provide a JavaDoc in Netbeans, but in IntelliJ that Doc is just missing.
Can you enable it somewhere that JavaDoc gets loaded with the jars?
Quick Documentation feature works using the sources attached to the JDK configuration like this:
Try to reinstall the JDK, remove it from IntelliJ IDEA and add it again. Double check src.zip is added in the Sourcepath.
I am having a weird problem with intellij. A handful of people in here, had similar issues in the past but none of the proposed solutions worked for me.
So I am trying to view the javadoc for a builtin class(in my example java.io.FileReader) but I am only getting information about the signature, not details about the method as it is usually happening. I have also tried things around quick and external documentation, I have even added an external doc url in the project settings but nothing happened.
In the screenshot you can see the output I am getting. Any help appreciated.
Looks like Eclipse uses a different approach for the documentation. Also I had a non-fully document API and thats, combined, the reason it was not working.
The solution is as follows: File -> Project structure -> SDKs -> Documentation paths -> Click the add button, with the earth on it -> Add an online documentation source.
If you click the other one, you need to space a folder in your filesystem.
Both work. Thank you for your help.
Ctrl + Q
This assumes you have the JDK (with documentation) downloaded and configured with IntelliJ for the relevant object/class/method.
Edit:
Turned out it was a problem with the Users' JDK.
The JDK source files didn't contain any comments (which IntelliJ uses to show JDK Documentation). This was resolved by installing the JDK Documentation and configuring it with IntelliJ.
I attached the src.zip that came with my JDK, but it seems to be missing a few files.
It's as if I don't have any of the sun.*; packages. I would understand if they maybe got changed out for java.awt.AppContext, but that doesn't exit.
I found AppContext in Container.java (been looking at how Oracle does things), but it shows me bytecode instead of actual code.
Where could I get these files? I looked around on google and found nothing /:
Another thing, when I manually import sun.awt, my IDE shows me that the package exists, but no files in it. Maybe I need to upgrade my JDK? (version 7u45, not too bad)
EDIT on December 30, 2014: Still looking for an answer, now using JDK 8u25
Often time the jar files that are eventually distributed out do not contain the source code of the library but only the built .class files, either aiming to reduce jar size or protect their source code. You may have to refer other resources in order to view the source code. I find www.codatlas.com to be a pretty good place to view some java open source projects. You can find the source code of java.awt.AppContext. It has a pretty IDE-like interface so you should be able to figure out how to use.
These types can be found via the OpenJDK's jdk GitHub Repository.
Here's the implementation for sun.awt.AppContext, which can be found under src > java.desktop > share > classes > sun > awt
I am using Jmockit for my unit tests and I have also included jmockit-coverage.jar in my classpath. Currently it generates the following files under 'coverage-reports' folder:coverage.css,coverage.js,index.html,logo.png,prettify.js
But its not generating coverage.xml. According to the document here - http://jmockit.googlecode.com/svn-history/r289/trunk/www/tutorial/CodeCoverage.html, I think I need to add 'jmockit-coverage-xmlfull.jar' in my class path. But I am not able to find that jar online. Its not available in jmockit download link.
Could you please let me know how to fix this issue?
Thanks,
Suresh
This link seems to be an older one showing an older svn revision number (r289). The latest one lies here http://jmockit.googlecode.com/svn-history/trunk/www/tutorial/CodeCoverage.html#output. Looks like it supports html as of now, but could not find xml. Basically the jmockit-coverage-output property is used to decide the output.
If you really need the xml version, you might need to download an older version which has all the jars. Try this link.
https://jmockit.googlecode.com/files/jmockit-0.993.zip
I was just curious to know this, when i give mvn install without doing 'clean', maven compiles only the modified java files. How does maven identify a java file is modified or not? I believe it is not using the last modified property of the file.
Reason for my belief: I had a module, after merging a change from svn, i gave mvn install and it didn't compile the modified file and when i looked at the change i saw that 'long' were modified to 'Long' in getters and setters.
So i just want to know how maven identifies if a java file has changed or not?
(P.S I'm using Apache Maven 3.0.3, if that matters)
I believe the Maven compiler plugin uses last modified dates on the source and class files to determine whether recompilation is necessary.
The compiler website is rather short on information, but the compiler:compile goal page has information on the following attribute, which finely tunes the staleness calculations: http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html#staleMillis. That's about the only official statement regarding staleness.
Without knowing much about maven, I can tell you that generally speaking, "make"-like tools use the "last changed" timestamp, which would explain the issue you had with svn ( see Wikipedia on Subversion's weaknesses.
Robert Scholte's comment at https://issues.apache.org/jira/browse/MCOMPILER-205 explains the process. It depends on the "useIncrementalCompilation" option of the "maven-compiler-plugin" (and on the version of it btw, I've only managed to have "useIncrementalCompilation" work with 3.1, not 3.0):
I see there's some confusion, so something needs to be changed, maybe
improving documentation is good enough. Looking at the code, you'll
see that non-incremental will only look at changed sourcefiles.
Incremental will also verifies if dependencies have changed and if
files have been added or removed. If it has changed, it'll remove the
complete classes-directory. The reason is that the default java
compiler is quite fast, likely much faster than analyzing per file
what to do with it. IIUC the eclipse compiler is a real incremental
compiler, so we could decide that based that based on the used
compiler not to drop the classes directory.