I had a problem with finding Java docs in Eclipse. I seem to have fixed the problem, but I'm posting this for two reasons: I would like to know why I had the problem in the first place and perhaps my method of fixing it might be useful to someone else having a similar problem.
I created a simple Java project in Eclipse (Helios on Windows 7) and selected the JavaSE-1.6 JRE. Then I created a source file and imported java.util.GregorianCalendar. When I hovered over GregorianCalendar, I was getting the message:
This element has no attached source and the Javadoc could not be found in the attached Javadoc
None of the methods of GregorianCalendar seemed to have any Javadoc, either. Other standard Java classes (even others in java.util, like ArrayList) didn't have this problem; only GregorianCalendar. Everything seemed set up properly in the project settings. The Javadoc location set in the Java Build Path was http://java.sun.com/javase/6/docs/api/.
I managed to restore correct behavior by temporarily switching to JavaSE-1.7 and then back. Evidently something got reset and all is well. While I'm happy that things are now working, I don't like being clueless as to how they got messed up in the first place.
Can anyone provide any insights into this?
I think general support relies on the presence of a src.zip in your JDK directory, which is detected when you autosearch a directory for Java installations. It could be missing. Not sure if online Javadocs are used.
I'm using Eclipse Juno on a Windows 7 64-bit (with a 32-bit JDK) but i think it will also apply to your Eclipse version:
Download JDK docs zip file to your Desktop folder;
Right-click on the file, choose Properties and unblock it;
Move the file to a location of your choice. I normally move it to the JDK folder;
Open Eclipse and go to Window->Preferences->Java->Installed JREs;
Select your JDK installation and press Edit;
Select the rt.jar file and click "Javadoc Location..." button;
Select the "Javadoc in archive" radio button;
Set the archive path by browsing to the JDK docs zip file;
Set the "Path within archive" to "docs/api" (without the quotes).
Enjoy! ;)
Related
I generated several Java projects last spring. Today I opened Eclipse back up and selected the workspace I used in the spring but now all the projects have a red X on them. They all list the same problem:
**The project was not built since its build path is incomplete. Cannot find the class file for java.lang.Object. Fix the build path then try building this project.**
The build path looks ok (I think). I tried to create a new project as an experiment to see it there are differences. The new project dialog box has **Use default JRE (Currently jre7)** checked and a warning at the bottom:
**The current workspace uses a 1.4 JRE with compiler compliance level 1.7. This is not recommendes and either the JRE or the compiler level should be changed.**
Not sure what changed since last spring but something obviously has. I don't really understand what it is trying to tell me. ?Anybody have any ideas I would greatly appreciate it. Thanks.
Update: I created a new project and compared its buildpath to one of the projects from last spring. In the new project, it has: **JRE System Library [JRE7]**
In the old project that now has the problem I see: **JRE System Library [JAVASE-1.7](unbound)**.
Somehow I think the "unbound" means something bad. Still do not understand how it was ok last spring and now suddenly it isn't.
The "unbound" means that there is no JRE at the path specified in the classpath. My guess is that, since last spring, modifications were made to your java installation(s).
To bind your project back on a JRE, click on your "unbound" JRE and click on the "Edit..." button. In the Edit Library window, select a working JRE (JRE 7 would probably be a good choice in your case), then click on Finish. The "Unbound" message should disappear and your classpath should be okay afterwards.
I have just installed the Java for OS X 2012-006 Developer Package from developer.apple.com and updated Eclipse Juno (the Springsoure toolsuite 3.1.0 version which is built on top of Juno) to use this JRE as the Execution environment and I also updated my projects to use this jdk.
In the JRE Definition dialog I attached source to classes.jar which is now pointing to /Library/Java/JavaVirtualMachines/1.6.0_37-b06-434.jdk/Contents/Home/src.jar
In this dialog I've tried letting the Javadoc point to Oracle online, to /Library/Java/JavaVirtualMachines/1.6.0_37-b06-434.jdk/Contents/Home/docs.jar OR /Library/Java/JavaVirtualMachines/1.6.0_37-b06-434.jdk/Contents/Home/Appledocs.jar
Yet, it seems impossible to get to the source when I need to, both in debug view or when just clicking on the class. I get "Source not found" all the time.
In addition when selecting classes.jar in package view and then "open attached javadoc" from the "Navigate" menu, a browser window opens that seems to point to the proper localhost URL (via http://127.0.0.1:59109/help/nftopic/jar:file:/[local path to docs.jar] ) but the window is empty.
I've read several suggestions here on stackoverflow and on blogs, somewhat recent I think, and still I can't get this to work this time. You have any suggestions for a different approach?
Update One thing that actually does work is hovering over source code with some class or interface from the JDK which give me the javadoc in the little yellow popup window and if I doubleclick the class I get the source for that class. And now seeing source code in debug view seem to work fine too. Hmmm.
So my expectations on how to get to source and javadoc in Eclipse is erroneous?
Well, it seems everything was done right after all with pointing the javadoc to /Library/Java/JavaVirtualMachines/[jdk-version]/Contents/Home/docs.jar. and so on. It seems I have to read up on when I can see source and javadoc in Eclipse.
I'l leave this as is if someone else need to know how to do this currently.
I am trying to lnclude an additional JDK (really JRE) to my eclipse project as i need to build against the IBM Java 5 JRE.
When I add the root folder of the jre it appears as if the core java class jars are not being added and only the jars in \lib\ext are being added. That is problem 1.
The next issues is I can't even manually add the jars by adding external jars to the runtime library. The reason being when I hit ok to save off the changes and then hit ok to the preferences dialog. The changes do not truly save. I open up the jre definition dialog again and only the jars in \lib\ext are there again.
Is this an eclipse bug? Is anybody finding similar results?
I'd really like to figure out where these preferences are stored so I can manually edit the file if need be.
As a side note, I have had a similar experience with not being able to save .pmd rule preferences and having to edit them manually in the backend. Though I suspect that bug is on the PMD developers.
Anyway any help on this is greatly appreciated.
Thanks.
I'm new to eclipse/java Mobile development and all the rest of the keywords.
I have just downloaded the eclipse pulsar package, and installed it, i also downloaded the 'java me sdk 3.0' and installed it and linked it in eclipse. now i can create a new midlet and i'm using the splash template as a start.
now i typed: g.drawString(...) and i have like a string argument which is supposed to be the string to display. and other three integers.
Now the problem is that there's no documentation at all. it's like you have to guess each argument is what.
I'm sure there's something called documentation right? but i don't what where is it's the sdk ? is it eclipse? where can i fix that?
even the 'string' type i couldn't find it's documentation.
EDIT:
now in my installed jres i have only jre6, though i also have installed jdk1.6.0 but it's not appearing i added it now...
But the main thing here, is that i had to download something called 'sun java wireless toolkit' which suggested to download the new feature 'sun_java_me_sdk-3_0-win.exe'. and i did, when i installed it i have a new section 'window->preferences->javame' which also contains missing configurations.
but there's a section in it called 'device management' (meaning the device that i need to work against, like standard hansets configurations) each with a set of jars. And very few jars have javadoc location set.
i know where the javadoc is now, but it's not covering all the jars i'm working with.
so to recap: i think i'm working against swt sdk and i need to link the libraries taht i'm working against to their corresponding javadoc. but not sure since it's not supposed that 'Graphics' class or 'string' class be used from this sdk and not the default java sdk 1.6.0?
i think i'll take this day to try to fix all this and really understand what libraries i'm working with and if i can download the rest of the javadocs and use them.
if it didn't work i'll go with netbeans. they say it's much easier to deploy
I did install netbeans, and the documentation is working. i saw inside netbeans that they are integrating the 'Java_ME_platform_SDK_3.0' but i don't know from where they provide the javadoc.
I have a simple walkaround that fix this problem. Just go to the library setting, you will see the javadoc of cldc11api.jar is missing, give it the same location as midp21api.jar, restart eclipse. Hope this work for you.
I don't have first-hand experience with Java ME development in Eclipse, but I will tell you how javadoc hookup works in Eclipse and you can investigate further.
Go to Window -> Preferences -> Java -> Installed JREs. You should find your Java ME install listed here.
Select it and hit Edit.
Expand various jar nodes under JRE system libraries. You will see source attachment and javadoc location.
If you don't see a location listed under javadoc, select that tree entry and hit Javadoc Location button to edit the location.
For me, using Java SE, I see location specified like this: http://java.sun.com/javase/6/docs/api/
It is possible that Eclipse simply doesn't know where to find Java ME javadoc. If you know the location, you can specify it in the above dialog. This could be a local or a remote URL.
If the location is specified and appears correct, the problem could be with network connectivity. If you are behind the proxy, make sure that it is correctly specified under Window -> Preferences -> General -> Network Connections.
my question is close to this question, you can refer to
Attach Javadoc to Eclipse for Java ME
anyway
Konstantin Komissarchik has also answered correctly to how you set the javadoc location.
Now the problem is with the 'Java_ME_platform_SDK_3.0', anyway through setting manually the configurations of javadoc location, igot it working after i restarted the eclipse with -clean argument.
I have a problem with Netbeans simply not recognizing Javadocs in external libraries. I've gone into the library path and specified a valid javadoc path (Netbeans accepts the path without error). But even after re-building/opening closing Netbeans, I still get the "Javadoc not found" error for all items in the library.
I'm stuck on where to go since there is no error message, and I can browse the docs using a web-browser. Any ideas?
The version of NEtbeans is 6.5.1
The files are uncompressed in a directory that has been added to the the Javadoc tab of the properties for the library. The library works as expected.
I've tried clearing the Netbeans cache to no effect.
I got it working. I deleted the library, the re-created it added the Javadocs. Now it works perfectly.
Could you please be more specific: What is your version of NetBeans? Where are those javadocs located? Are they unpacked in a separate folder, in a zip file, in jar file?
Here is a working solution for NetBeans 6.5 for an example:
Go to Project Properties > Libraries dialog
On "Compile" tab press the "Add JAR/Folder" button and locate your library
On "Compile" tab press the "Edit" button with your library selected
Add path to either: a) docs folder of that library, containing index.html and the rest of the files; b) zip file, containing that libraries docs folder;
It should work without re-building your project or restarting NetBeans.
If you have created a custom library, it can be edited in a very similar fashion through "Tools > Libraries"
Sounds similar to a problem i had recently, turned out all i had to do was delete the cache to force NetBeans to rebuild.
If #slink84's suggestion fails to help, you might try #dr Hanibbal Lecter's method from my question on stackoverflow