Attach jdk source for 1.6.0_37-b06-434 and javadoc in Eclipse Juno on OS X 10.7 Lion - osx-lion

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.

Related

Eclipse IDE - Open Call Hierarchy is empty/broken

What should I do, if the "Open Call Hierarchy" is broken (empty for every method in a project)? It only shows the name of the method I wanted to see the call hierarchy for. This happens for all methods I try, even though they are all called by other methods.
It is very useful for code navigation. I do not know how to work without it!
I've tried:
Opening eclipse.exe -clean -refresh
Restarting Eclipse
Closing and reopening the project
Updating the project
Renaming the .metadata file
I've checked that it searches the whole workspace, and there are no filters on.
The following may help:
Calling eclipse with eclipse.exe -clean -refresh forces Eclipse to rebuild the index. After that the feature worked again.
Closing and re-opening the project.
I also tried the suggestions above, as well as the hint given here: http://mschrag.blogspot.co.at/2009/01/open-type-cant-find-your-class.html
Nothing worked until today when I found out that I am a donkey...
I once configured a filter in the "Call Hierarchy" view and so no entries were shown because filtered out. Once I removed / disabled the filter everything worked fine again.
When you go to the eclipse bug report for this issue, somebody says, you should install over the Market place the Java 12 support.
When I installed it, it was working properly again
Also, you can try to delete the workspace and get it recreated. Make sure all your projects are backed up.
For Kepler and PDT (PHP IDE) it is broken in at least PDT 3.2.0 and 3.3.0 (tried them both). The fix is in 3.3.1 and updating to that was all I had to do get the call hierarchy working again.
(apologies, I'm not yet allowed to add comments, however this should prove handy to many)
In my case it seemed my workspace was contaminated.
Opening/closing projects and starting with clean did not fix. I had to start off a new workspace.
Fedora 20, Eclipse Kepler.
I have the same behavior with eclipse Kepler (4.3.2).
I found out, that there is a bug with methods with signature of:
void get(Object o)
Object get(Object o)
In the eclipse Error Log view I find the following exception:
java.lang.NullPointerException
at org.eclipse.jdt.internal.core.search.matching.ClasspathSourceDirectory.directoryTable(ClasspathSourceDirectory.java:52)
at org.eclipse.jdt.internal.core.search.matching.ClasspathSourceDirectory.findClass(ClasspathSourceDirectory.java:109)
at org.eclipse.jdt.internal.core.search.matching.JavaSearchNameEnvironment.findClass(JavaSearchNameEnvironment.java:146)
at org.eclipse.jdt.internal.core.search.matching.JavaSearchNameEnvironment.findType(JavaSearchNameEnvironment.java:185)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:145)
at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:197)
at org.eclipse.jdt.internal.compiler.lookup.Scope.getTypeOrPackage(Scope.java:2799)
at org.eclipse.jdt.internal.compiler.lookup.Scope.getType(Scope.java:2556)
at org.eclipse.jdt.internal.core.search.matching.MatchLocator.getType(MatchLocator.java:899)
at org.eclipse.jdt.internal.core.search.matching.MatchLocator.getMethodBinding0(MatchLocator.java:955)
at org.eclipse.jdt.internal.core.search.matching.MatchLocator.getMethodBinding(MatchLocator.java:907)
at org.eclipse.jdt.internal.core.search.matching.MethodLocator.matchMethod(MethodLocator.java:327)
at org.eclipse.jdt.internal.core.search.matching.MethodLocator.resolveLevel(MethodLocator.java:664)
at org.eclipse.jdt.internal.core.search.matching.ClassFileMatchLocator.locateMatches(ClassFileMatchLocator.java:209)
at org.eclipse.jdt.internal.core.search.matching.MatchLocator.process(MatchLocator.java:1699)
at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1143)
at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1184)
at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1301)
at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches(JavaSearchParticipant.java:95)
at org.eclipse.jdt.internal.core.search.BasicSearchEngine.findMatches(BasicSearchEngine.java:231)
at org.eclipse.jdt.internal.core.search.BasicSearchEngine.search(BasicSearchEngine.java:515)
at org.eclipse.jdt.core.search.SearchEngine.search(SearchEngine.java:584)
at org.eclipse.jdt.internal.corext.callhierarchy.CallerMethodWrapper.findChildren(CallerMethodWrapper.java:155)
at org.eclipse.jdt.internal.corext.callhierarchy.MethodWrapper.performSearch(MethodWrapper.java:301)
at org.eclipse.jdt.internal.corext.callhierarchy.MethodWrapper.doFindChildren(MethodWrapper.java:232)
at org.eclipse.jdt.internal.corext.callhierarchy.MethodWrapper.getCalls(MethodWrapper.java:84)
at org.eclipse.jdt.internal.ui.callhierarchy.DeferredMethodWrapper.getCalls(DeferredMethodWrapper.java:65)
at org.eclipse.jdt.internal.ui.callhierarchy.DeferredMethodWrapper.fetchDeferredChildren(DeferredMethodWrapper.java:79)
at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:235)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
In the end, it looks like a bug in this version:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=401272
I assume, that upgrading at least to version 4.4 (Luna) will solve this problem.
In my case I was trying to get the call hierarchy of a method in the derived class of an abstract class. The requested method was declared abstract in the base class.
When I opened the call hierarchy directly on the abstract method instead of the implemented one, everything worked well. (Eclipse Neon).
My problem was that Open Call Hierarchy was searching only the project not the entire Workspace.
So I had to click on the small down arrow (in the Call Hierarchy view window on the right; it is the "View Menu" arrow -- a triangle pointing down) in Call Hierarchy view, set the Search Scope > Workspace.
Tried everything in all the answers here, but none of them worked for me. Later I figured out that this was a bug in Eclipse 2019-03 (https://bugs.eclipse.org/bugs/show_bug.cgi?id=545293). Try to upgrade your eclipse or install a newer version.
For me installing a newer version(latest version Eclipse 2019-09) solved the problem.
I tried many answers all were great, it helped many except few and I was in few.
My eclipse version is 2019-03(4.11.0). This is which has a bug. Which can be fixed by add-ons.
Go to the Eclipse Marketplace and search for plugin java 12 Support for Eclipse 2019-03(4.11)… and install it. On completion of installation restart the eclipse. Hopefully this will fix the problem. Have a nice day.
If the call Hierarchy is not opening, it might be because of the project is not imported as a java project, rather it would be displayed in the file stucture. You may want to enable the project facet through:
right click on the project -> project facet.
If you dont see anything listed, you need
configure the project facet -> Apply -> ok.

Mysterious Eclipse javadoc problem

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! ;)

documentation missing in eclipse

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.

Debug Maven project in Eclipse with third party sources

I am currently developing a maven project in eclipse. The m2eclipse plugin works beautifully. It even works out of the box with debugging.
But when I am debugging open source third party libarries. It seems maven could automatically pull the source code down, but the eclipse debugger cannot resolve the currently execution point to the correct source file location.
I am sure the source code is downloaded because I can look at it and set break point. And the break point works.
But eclipse shows the source code and the currently execution point in too different windows. An example would be "TransformerImpl.class" tab window shows the source code, but the current execution point in shown in another tab window with header "Transformer.transform(Source,boolean)Line:642". This windows shows no source code.
I am felling there is some simple configuration that I am missing that could make this work. Then it will be really beautiful.
I think it is a bug introduced in one of the last m2eclipse versions. So, the workaround is to click on "Edit Source Attachment" button in the editor opened for a missing class and manually attach the source jar from the Maven local repository where it is downloaded by m2eclipse.
You should actually report this issue to m2eclipse, so developers can fix it in the future versions.

In Eclipse, why does "Build Automatically" get mysteriously disabled?

I'm running Eclipse Europa (3.3). I leave the "Build Automatically" setting, under the Project menu, on all the time. Once in awhile my code isn't compiling, and I puzzle over it and then pull down the Project menu ... lo and behold, it's not set anymore. What gives? Is this a bug, or is there something else I'm doing that could cause it?
Edit: I am running the regular Java developer installation, plus Subversive and its connectors, Jetty Launcher, and I believe no other plugins. Other people at my workplace have had the same problem.
Edit: I am still having this problem once in a blue moon, only now I'm using Eclipse Galileo (3.5) for Windows. I haven't had this problem in Galileo for OS X, neither in Cocoa nor Carbon, but I have not used that for as long.
With Eclipise Mars.1 (4.5.1), Oomph may be the culprit. Eclipse Oomph supports automatically disabling Build Automatically with entries in
On Windows
%USERPROFILE%\.eclipse\org.eclipse.oomph.setup\setups\user.setup
If you want to disable this Oomph behavior try deleting the following setting
"Eclipse->Navigate Menu-> Open Setup menu entry-> Open User menu entry", a Preference Task under "User Preferences -> org.eclipse.core.resources -> description.autobuilding"
I learned about this setting by posting to the Oomph Eclipse Community Forum on Feb 8th, 2016. I posted a question titled "Oomph Defect? Build Automatically Keeps Getting Disabled". Ed Marks replied the same day with details about Oomph's support for managing the Eclipse "Build Automatically" setting.
https://www.eclipse.org/forums/index.php/m/1722751/#msg_1722751
I don't have eclipse right here to test and make sure but here is an idea.
Is any of the project or even workspace file in SVN ? if they are and they were uploaded with auto build disabled that might explain it
You update and overwrite your settings. This doesn't become apparent until you restart eclipse. this would also explain why other people at your workplace experienc this. it would even explain why some don't : thay are the ones who are careful what they update and don't allow eclipse to overwrite their own settings plus the ones who actually prefer to have autobuild disabled :)
I had the same problem and when I looked at the Source tab under Java Build Path (under the menu Project > Properties ) there were some source directories that didn't exist anymore (marked with a red X). After I deleted them, compilation worked fine and all new .class files are under the bin folder.
Strange. Is there perhaps a plugin installed that turns this off without your knowledge?
Maybe there is some conflicting shortcut. For example, some duplicated shortcut may be toggling it.
I am running 3.4 and I also have this mysterious behavior. I had it in 3.3 as well. I use CVS not SVN. Does not seem to follow a pattern just once in a while it gets switched off and then weird confusing stuff happens until I remember to check it and switch it back on. I am almost to the point where I want to write a plugin to always turn it on when eclipse loads.
When installing Google Plugin for Eclipse, 'Google App Engine for Android' is also installed.
For me, I uninstalled 'Google App Engine for Android', which I didn't need, and solved this problem.