Eclipse Generate Javadoc Wizard: what is "Javadoc Command"? - java

I want to generate the javadocs for an open-source code-base I'm using. But I'm being asked for a "Javadoc Command" by the Eclipse Generate JavaDoc wizard and the help doesn't explain what this means. Is it wanting the path to the javadoc binary/jar or something else?

Yes, presumably it wants the path to the javadoc command line tool that comes with the JDK (in the bin directory, same as java and javac).
Eclipse should be able to find it automatically; are you perhaps running it on a JRE? That would explain the request.

Yes, it is asking for the application/executable that is capable of creating Javadoc. There is a javadoc executable inside the jdk's bin folder.

You may need to add a JDK (Java Development Kit) to the installed JRE's within Eclipse
Go to Window->Preferences->Java->Installed JRE's
In the Name column if you do not have a JDK as your default, then you will need to add it.
Click the "Add" Button and locate the JDK on your machine.
You may find it in this location: C:\Program Files\Java\jdk1.x.y
Where x and y are numbers.
If there are no JDK's installed on your machine then download and install the Java SE (Standard Edition) from the Oracle website.
Then do the steps above again. Be sure that it is set as the default JRE to use.
Then go back to the Projects->Generate Javadoc... dialog
Now it should work.
Good Luck.

Had this problem and solved typing this : C:\Program Files (x86)\Java\jdk1.7.0_51\bin\javadoc.exe

There are already useful answers to this question above, however there is one more possibility which I don't see being addressed here.
We should consider that the java is installed correctly (that's why eclipse could have been launched in the first place), and the JDK is also added correctly to the eclipse. So the issue might be for some reason (e.g. migration of eclipse to another OS) the path for javadoc is not right which you can easily check and modify in the javadoc wizard page. Here is detailed instructions:
Open the javadoc wizard by Project->Generate Javadoc...
In the javadoc wizard window make sure the javadoc command path is correct as illustrated in below screenshot:

Related

How can I change the JDK version into JDK 10 in NetBeans? [duplicate]

I have the older NetBeans 6.7, NetBeans 6.9, and NetBeans 7.0, which used to run on jdk1.6.0_21 and jdk1.6.0_25. Now I've removed those JDKs and only have jdk1.6.0_26 and jdk1.7.0 left, but I still want to keep the older versions of NetBeans, but now when I run them, I get this message:
"Cannot locate java installation in specified jdkhome C:\Program Files (x86)\Java\jdk1.6.0_25
Do you want to try to use default version?"
I tried to find where it's looking for the "jdk1.6.0_25", and updated a few configuration files in "C:\Program Files (x86)\NetBeans 6.7" and "C:\Users\USER.nbi\registry.xml", and yet the message keeps coming. Where and what do I need to change to point it to C:\Program Files (x86)\Java\jdk1.6.0_26?
Thanks to Kasun Gajasinghe's tip, I found the solution in the "suggested" link. Update the following file (replace 7.x with your NetBeans version):
C:\Program Files\NetBeans 7.x\etc\netbeans.conf
Change the following line to point it where your Java installation is:
netbeans_jdkhome="C:\Program Files\Java\jdk1.7xxxxx"
You may need administrator privileges to edit netbeans.conf.
Go to Tools* → Java Platforms. There, click on Add Platform and point it to C:\Program Files (x86)\Java\jdk1.6.0_25. You can either set the another JDK version or remove existing versions.
Another solution suggested on the Oracle (Sun) site is,
netbeans.exe --jdkhome "C:\Program Files\jdk1.6.0_20"
I tried this on 6.9.1. You may change the JDK per project as well. You need to set the available JDKs via the Java Platforms dialog. Then, go to Run → Set Project Configuration → Customize.
After that, in the opened dialog box, go to menu Build → Compile. Set the version.
For those not using Windows, the file to change is netbeans-8.0/etc/netbeans.conf.
And the line(s) to change is:
netbeans_jdkhome="/usr/lib/jvm/java-8-oracle"
Comment out the old value and insert the new value.
As a further useful solution for those of you on Windows 7 and above - if you use
cd "C:\Program Files\Java"
mklink /D jdk8 jdk1.8.0_25
you get a symbolic link folder that can be adjusted whenever a new JDK comes out.
All you need to do then is set your
netbeans_jdkhome="C:\Program Files\Java\jdk8"
(in both locations for NetBeans 8) and you never have to edit the configuration again. Just tweak the symlink each time your JDK is updated.
I had this message too because today I decided to relocate my different JDK in the same directory. I have decided to uninstall all through the program manager of Windows. After that, of course I had the message below.
"Cannot locate java installation in specified jdkhome C:\Program Files (x86)\Java\jdk1.7.0_60. Do you want to try to use the default version?"
A new install of the JDK does not resolve the problem. OK, you can configure that in menu Tools → Java platforms, but in my case I had to fix my netbeans.conf file.
I had the line below:
netbeans_jdkhome="C:\Program Files\Java\jdk1.7.0_60"
And I replaced it by:
netbeans_jdkhome="C:\devtools\Java\jdk1.8.0_25"
It does not exactly answer your question, but to get around the problem,
you can either create a .cmd file with following content:
start netbeans --jdkhome c:\path\to\jdk
or in the shortcut of Netbeans set the above option.
Where you already have a project in NetBeans and you wish to change the compiler (e.g. from 1.7 to 1.) then you would need to also change the Java source compiler for that project.
Right-click on the project and choose Properties as outlined below:
Then check that the project has the necessary source circled below:
Then check that the Java compiler is correct for the project:
All the other answers have described how to explicitly specify the location of the Java platform, which is fine if you really want to use a specific version of Java. However, if you just want to use the most up-to-date version of the JDK, and you have that installed in a "normal" place for your operating system, then the best solution is to not specify a JDK location. Instead, let the NetBeans launcher search for the JDK every time you start it up.
To do this, do not specify jdkhome on the command line, and comment out the line setting netbeans_jdkhome variable in any netbeans.conf files. (See other answers for where to look for these files.)
If you do this, when you install a new version of Java, your NetBeans installation will automagically use it. In most cases, that's probably exactly what you want.
In Windows, open cmd.
Go to the directory where your NetBeans file downloaded.
Then run the below command. The JDK path may be different from the path I mentioned.
netbeans-8.2-windows.exe --javahome "C:\Program Files\Java\jdk-9.0.1"

JAVA SE 8, JDK-8u151.exe installation doesn't include src.zip file [duplicate]

I installed the JDK8u40, but only find the javafx-src.zip.
Where can I find the source code for JDK? The src.zip?
Below is what I get after installation:
And btw, I didn't see the installation wizard! This is quite strange.
ADD 1
Today I tried several Java installation packages. All are downloaded from Oracle official site.
jdk-6u45-windows-i586.exe
jdk-7u75-windows-i586.exe
jdk-8u20-windows-i586.exe
jdk-8u25-windows-i586.exe
jdk-8u31-windows-i586.exe
jdk-8u40-windows-i586.exe
Both 6u45 and 7u75 installed well on my box. I can see the install wizard. And the src.zip is installed.
But 8u25 ~ 8u40 all installed silently. And no src.zip file is installed because I have no chance to select it in the wizard.
I am not sure if this is my fault or someone at Oracle made a mistake.
As #SubOptimal commented, the /s option indicates a silent install. I am wondering if there's an option to force the GUI install wizard to open.
I am using Windows 7 Enterprise x64 Build 7601 SP1
Make sure the Source code is not disabled when downloading.
Then as you can see on the picture, selecting "Source Code" will tell you exactly where it is located.
Notice that I've downloaded the 32 bits version to make sure to reproduce the same use case as you.
Edit
As per your new edits and comments, it seems what you want to know now is why you don't see the installation wizards. I'm pretty sure this is due to old-set registry key.
Run the following command
reg query hklm\software\microsoft\windows\currentversion\installer\UserData\S-1-5-18\Products /f "java" /s | find "HKEY_LOCAL_MACHINE"
Now, navigate to each of the returned path browsing with regedit and delete their entire parent (the big hexa number).
Re-try the installation and I'm pretty sure you will see the wizard.
As for the sources, Oracle documentation specify how to download them in silent mode.
jdk.exe /s ADDLOCAL="SourceFeature"
This is the way I got the src folder from jdk-8u172-windows-x64.exe file without installing.
Step1: Download jdk-8u172-windows-x64.exe file (Java SE Development Kit 8u172) from oracle site
Step2: Extract it and navigate to the path:
\jdk-8u172-windows-x64.rsrc\1033\JAVA_CAB9
Step3: Right click on file named "110" and extract it.
You will get the src.zip file.
It took me little while to figure this out. I hope it will help others.
Enjoy debugging Good Code!
I don't know why/where the src.zip is, but as an alternative, if all you want is the source and somehow the proposed method doesn't work for you, you could always pull directly from the JDK8u40 source tree.
You will need Mercurial instead of Git. This link talks about the hg clone command
Quoting from the OpenJDK Java.net site
The corresponding master forest jdk8u can be cloned using this command: hg clone http://hg.openjdk.java.net/jdk8u/jdk8u;cd jdk8u;sh get_source.sh .
In addition, the source code for the last release, 8u40, is available by cloning the 8u40 master forest : http://hg.openjdk.java.net/jdk8u/jdk8u40. The final build of that release was tagged as jdk8u40-b25.
There are differences between OpenJDK and Oracle's, though subtle
download JDK 8 from following link
http://www.oracle.com/technetwork/java/javase/jdk-8-readme-2095712.html
src.zip comes in-built with it
if you JDK installer silently skips installing the source. just open the control panel > programs an features and find Java. Right click on it and select change and then select the
source (option) ;)
Download the JDK
Run the Installer, but stop right away
Extract src.zip from C:\Users\<your_username>\AppData\LocalLow\Oracle\ss180121.cab
You can extract .zip from .cab with tool like 7Zip
Taken from

How can I set the JDK NetBeans runs on?

I have the older NetBeans 6.7, NetBeans 6.9, and NetBeans 7.0, which used to run on jdk1.6.0_21 and jdk1.6.0_25. Now I've removed those JDKs and only have jdk1.6.0_26 and jdk1.7.0 left, but I still want to keep the older versions of NetBeans, but now when I run them, I get this message:
"Cannot locate java installation in specified jdkhome C:\Program Files (x86)\Java\jdk1.6.0_25
Do you want to try to use default version?"
I tried to find where it's looking for the "jdk1.6.0_25", and updated a few configuration files in "C:\Program Files (x86)\NetBeans 6.7" and "C:\Users\USER.nbi\registry.xml", and yet the message keeps coming. Where and what do I need to change to point it to C:\Program Files (x86)\Java\jdk1.6.0_26?
Thanks to Kasun Gajasinghe's tip, I found the solution in the "suggested" link. Update the following file (replace 7.x with your NetBeans version):
C:\Program Files\NetBeans 7.x\etc\netbeans.conf
Change the following line to point it where your Java installation is:
netbeans_jdkhome="C:\Program Files\Java\jdk1.7xxxxx"
You may need administrator privileges to edit netbeans.conf.
Go to Tools* → Java Platforms. There, click on Add Platform and point it to C:\Program Files (x86)\Java\jdk1.6.0_25. You can either set the another JDK version or remove existing versions.
Another solution suggested on the Oracle (Sun) site is,
netbeans.exe --jdkhome "C:\Program Files\jdk1.6.0_20"
I tried this on 6.9.1. You may change the JDK per project as well. You need to set the available JDKs via the Java Platforms dialog. Then, go to Run → Set Project Configuration → Customize.
After that, in the opened dialog box, go to menu Build → Compile. Set the version.
For those not using Windows, the file to change is netbeans-8.0/etc/netbeans.conf.
And the line(s) to change is:
netbeans_jdkhome="/usr/lib/jvm/java-8-oracle"
Comment out the old value and insert the new value.
As a further useful solution for those of you on Windows 7 and above - if you use
cd "C:\Program Files\Java"
mklink /D jdk8 jdk1.8.0_25
you get a symbolic link folder that can be adjusted whenever a new JDK comes out.
All you need to do then is set your
netbeans_jdkhome="C:\Program Files\Java\jdk8"
(in both locations for NetBeans 8) and you never have to edit the configuration again. Just tweak the symlink each time your JDK is updated.
I had this message too because today I decided to relocate my different JDK in the same directory. I have decided to uninstall all through the program manager of Windows. After that, of course I had the message below.
"Cannot locate java installation in specified jdkhome C:\Program Files (x86)\Java\jdk1.7.0_60. Do you want to try to use the default version?"
A new install of the JDK does not resolve the problem. OK, you can configure that in menu Tools → Java platforms, but in my case I had to fix my netbeans.conf file.
I had the line below:
netbeans_jdkhome="C:\Program Files\Java\jdk1.7.0_60"
And I replaced it by:
netbeans_jdkhome="C:\devtools\Java\jdk1.8.0_25"
It does not exactly answer your question, but to get around the problem,
you can either create a .cmd file with following content:
start netbeans --jdkhome c:\path\to\jdk
or in the shortcut of Netbeans set the above option.
Where you already have a project in NetBeans and you wish to change the compiler (e.g. from 1.7 to 1.) then you would need to also change the Java source compiler for that project.
Right-click on the project and choose Properties as outlined below:
Then check that the project has the necessary source circled below:
Then check that the Java compiler is correct for the project:
All the other answers have described how to explicitly specify the location of the Java platform, which is fine if you really want to use a specific version of Java. However, if you just want to use the most up-to-date version of the JDK, and you have that installed in a "normal" place for your operating system, then the best solution is to not specify a JDK location. Instead, let the NetBeans launcher search for the JDK every time you start it up.
To do this, do not specify jdkhome on the command line, and comment out the line setting netbeans_jdkhome variable in any netbeans.conf files. (See other answers for where to look for these files.)
If you do this, when you install a new version of Java, your NetBeans installation will automagically use it. In most cases, that's probably exactly what you want.
In Windows, open cmd.
Go to the directory where your NetBeans file downloaded.
Then run the below command. The JDK path may be different from the path I mentioned.
netbeans-8.2-windows.exe --javahome "C:\Program Files\Java\jdk-9.0.1"

Problem with java-doc for standard java library

I recently started using Ubuntu and installed netbeans 6.9.1. I seem to be missing some javadocs tho that get installed with the windows version.
Basically the netbeans docs are there but when the code completion comes up it only tells me the function prototype. Where theres usually a description it says that the javadocs are not found and they should be added in the platform or library manager.
Basically I just want the docs explaining the methods for basic java, swing, and awt. Anyone know what files it is i want to be getting, and can I do it all with apt-get?
OS:
Ubuntu 10
Probably you have not installed java-doc package:
sudo apt-get install sun-java6-doc
or what ever is suitable for you.
I had the same problem. Solution is very simple:
You have to download "Java SE 6 Documentation" from this page (in Additional Resources list)
http://www.oracle.com/technetwork/java/javase/downloads/index.html
It is a zip file (~50 mb). Put this file to some place you like(I suggest you to put it to the JDK directory, but you can put it to your home directory) and then open NetBeans.
Select Tools -> Java Platforms. Then select JDK on the left window. In the Javadoc tab, click Add ZIP/Folder and choose file you recently download.
When you done this, your javadoc in code completition windows will work correctly.

JDK documentation in IntelliJ IDEA on Mac OS X

I'd like to know how to setup IntelliJ to point to the JDK documentation so the documentation popups that display during code completion will show me what the function I'm looking at is going to do. For some reason IntelliJ isn't able to find the JavaDocs by default.
I'm also not 100% sure that the documentation is installed with the JDK that's installed with the OS. I don't see them in /System/Library/Frameworks/JavaVM.framework/ but I may be looking in the wrong place. If it's not included, I'd also like to know what needs to be downloaded and where it needs to be installed to get the JavaDocs for the JDK to show up in IntelliJ.
I had to combine the responses I got to this point and add a few extra details so I'm answering my own question.
Search for "Java developer" from Downloads for Apple Developers
Download and install "Java for Mac OS X 10.6 Update 9 Developer Package" (or later).
In IntelliJ, open File -> Project Structure.
Click on "SDKs" under "Platform Settings".
Add the following paths under the "Documentation Paths" tab (the paths may be different based on which JDK you're using):
/Library/Java/JavaVirtualMachines/1.6.0_29-b11-402.jdk/Contents/Home/docs.jar!/docs/api
/Library/Java/JavaVirtualMachines/1.6.0_29-b11-402.jdk/Contents/Home/appledocs.jar!/appledoc/api
Add the following path under the Sourcepath tab:
/Library/Java/JavaVirtualMachines/1.6.0_29-b11-402.jdk/Contents/Home/src.jar!/src
Thanks, #Yishai for the download location and #Gareth Davis for the location of the documentation after installing.
Update for 10.7/10.8 [Mountain] Lion:
Steps are the same except for these changes:
In step 2, download "Java for OS X 2012-005 Developer Package" (or later).
Use these paths instead in step 5.
/Library/Java/JavaVirtualMachines/1.6.0_35-b10-428.jdk/Contents/Home/docs.jar!/docs/api
/Library/Java/JavaVirtualMachines/1.6.0_35-b10-428.jdk/Contents/Home/appledocs.jar!/appledoc/api
Use these paths instead in step 7.
/Library/Java/JavaVirtualMachines/1.6.0_35-b10-428.jdk/Contents/Home/src.jar!/src
Quick (and dirty?) solution: Point IntelliJ to http://download.oracle.com/javase/6/docs/api/
have you installed the Apple Java Developer package?
It provides src.jar and docs.jar in /Library/Java/JavaVirtualMachines/1.6.0_22-b04-307.jdk/Contents/Home
Note this is since update 3. If these are present Intellij will just find them, or at least mine did.
details are in the Java update release notes
This should tell you what you need to know: Get local copies of Mac OS X Java source code and Javadoc – Concord Consortium wiki.
That page recommends going to https://connect.apple.com and downloading and installing “Java for Mac OS X 10.5 Update 2 Developer Documentation (Disk Image)” or the equivalent newer release. It describes a few ways to view the documentation, based on the Java jar file being located at a path like this:
/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/src.jar

Categories

Resources