隨着Eclipse書寫java碼時間,有時候,由於咱們不知道java函數返回。經過鼠標移動到java該功能,假設它javadoc相關內容將被顯示。css
可是,並不是全部java代碼javadoc;連裝javadoc。於eclipse假設沒有設置。使用。html
我在win7下安裝的是javase的jdk。發現eclipse中默認的javadoc路徑是http://download.oracle.com/javase/7/docs/api/,顯然這是一個在線資源。問題是網絡老是不穩定的,有時候看不到相應的文檔內容。java
so,what should we do?and what can we do?!sql
一個顯而易見的解決方法是下載javadoc並在本地安裝。而後在eclipse中改動javadoc的路徑。但是,爲何要下載javadoc?不是有一個命令也叫javadoc的麼?不能用麼?在java安裝路徑下可以找到一個叫src.zip的壓縮包,裏面是java的源代碼,而且有凝視,應該可以生成javadoc的。到oracle官方上看了一下。發現javase版本號的jdk就是不帶文檔的,而javaee版本號的jdk卻帶文檔。好吧,反正我對oracle沒有什麼好感。對此我僅僅能呵呵。chrome
怎樣手動生成本地javadoc api文檔?對於jdk中的java源代碼,因爲包括太多的包,所以需要統計所有使用到的包。也就是「當前路徑下包括java文件的所有目錄」。apache
ok。因爲google不能用。百度出來的結果基本上是沒參考價值,惟一實用的一個是分析swf源代碼的樣例,夠了。經過獲取所有包的路徑並存儲在一個叫package.txt的文件裏。並存儲在java源代碼解壓後的路徑src下,而後執行cmd。cd到src路徑,輸入javadoc javadoc -d api @package.txt命令,靜候5分鐘,文檔就會生成完成!bootstrap
而後咱們也可以經過chrome打開。比方JComponent.html頁面:windows
附:用來獲取java源代碼中所有包括java文件的文件夾的代碼:api
package util; import java.io.File; import java.util.Vector; public class SniffDir { private String srcDir; private Vector<String> vs; public SniffDir(){ srcDir="D:/workspace/src"; vs=new Vector<String>(); } /** * Sniff函數, 事實上就是一個DFS,深度優先搜索 * 用來獲取src文件夾下的知足「當前路徑下存在.java文件」這一條件的所有文件夾 * @param file */ public void Sniff(File file) { //File file=new File(curDir); File[] files=file.listFiles(); int len=files.length; boolean ok=false;//表示當前文件夾下是否有java文件,ok=true表示有並且記錄過了。for(int i=0; i<len; i++){ //System.out.println(files[i].toString()); if(files[i].isDirectory()){ Sniff(files[i]); }else if(files[i].isFile() && !ok){//files[i]爲文件(確定是java文件)。並且尚未把當前路徑放入向量vs中 ok=true; vs.addElement(file.toString().substring(srcDir.length()+1)); //System.out.println(files[i].toString()); } } } String sb=null; public void Print(){ int len=vs.size(); for(int i=0; i<len; i++){ sb=vs.get(i); sb=sb.replace('\\', '.'); System.out.println(sb); } } public static void main(String[] args){ SniffDir sd=new SniffDir(); sd.Sniff(new File(sd.srcDir)); sd.Print(); } } 網絡
com.sun.corba.se.impl.activation com.sun.corba.se.impl.copyobject com.sun.corba.se.impl.corba com.sun.corba.se.impl.dynamicany com.sun.corba.se.impl.encoding com.sun.corba.se.impl.interceptors com.sun.corba.se.impl.io com.sun.corba.se.impl.ior com.sun.corba.se.impl.ior.iiop com.sun.corba.se.impl.javax.rmi.CORBA com.sun.corba.se.impl.javax.rmi com.sun.corba.se.impl.legacy.connection com.sun.corba.se.impl.logging com.sun.corba.se.impl.monitoring com.sun.corba.se.impl.naming.cosnaming com.sun.corba.se.impl.naming.namingutil com.sun.corba.se.impl.naming.pcosnaming com.sun.corba.se.impl.oa com.sun.corba.se.impl.oa.poa com.sun.corba.se.impl.oa.toa com.sun.corba.se.impl.orb com.sun.corba.se.impl.orbutil com.sun.corba.se.impl.orbutil.closure com.sun.corba.se.impl.orbutil.concurrent com.sun.corba.se.impl.orbutil.fsm com.sun.corba.se.impl.orbutil.graph com.sun.corba.se.impl.orbutil.threadpool com.sun.corba.se.impl.presentation.rmi com.sun.corba.se.impl.protocol com.sun.corba.se.impl.protocol.giopmsgheaders com.sun.corba.se.impl.resolver com.sun.corba.se.impl.transport com.sun.corba.se.impl.util com.sun.corba.se.internal.corba com.sun.corba.se.internal.CosNaming com.sun.corba.se.internal.iiop com.sun.corba.se.internal.Interceptors com.sun.corba.se.internal.POA com.sun.corba.se.org.omg.CORBA com.sun.corba.se.pept.broker com.sun.corba.se.pept.encoding com.sun.corba.se.pept.protocol com.sun.corba.se.pept.transport com.sun.corba.se.PortableActivationIDL com.sun.corba.se.PortableActivationIDL.InitialNameServicePackage com.sun.corba.se.PortableActivationIDL.LocatorPackage com.sun.corba.se.PortableActivationIDL.RepositoryPackage com.sun.corba.se.spi.activation com.sun.corba.se.spi.activation.InitialNameServicePackage com.sun.corba.se.spi.activation.LocatorPackage com.sun.corba.se.spi.activation.RepositoryPackage com.sun.corba.se.spi.copyobject com.sun.corba.se.spi.encoding com.sun.corba.se.spi.extension com.sun.corba.se.spi.ior com.sun.corba.se.spi.ior.iiop com.sun.corba.se.spi.legacy.connection com.sun.corba.se.spi.legacy.interceptor com.sun.corba.se.spi.logging com.sun.corba.se.spi.monitoring com.sun.corba.se.spi.oa com.sun.corba.se.spi.orb com.sun.corba.se.spi.orbutil.closure com.sun.corba.se.spi.orbutil.fsm com.sun.corba.se.spi.orbutil.proxy com.sun.corba.se.spi.orbutil.threadpool com.sun.corba.se.spi.presentation.rmi com.sun.corba.se.spi.protocol com.sun.corba.se.spi.resolver com.sun.corba.se.spi.servicecontext com.sun.corba.se.spi.transport com.sun.image.codec.jpeg com.sun.imageio.plugins.bmp com.sun.imageio.plugins.common com.sun.imageio.plugins.gif com.sun.imageio.plugins.jpeg com.sun.imageio.plugins.png com.sun.imageio.plugins.wbmp com.sun.imageio.spi com.sun.imageio.stream com.sun.java.swing com.sun.java.swing.plaf.gtk com.sun.java.swing.plaf.motif com.sun.java.swing.plaf.motif.resources com.sun.java.swing.plaf.nimbus com.sun.java.swing.plaf.windows com.sun.java.swing.plaf.windows.resources com.sun.javadoc com.sun.java_cup.internal.runtime com.sun.jmx.defaults com.sun.jmx.interceptor com.sun.jmx.mbeanserver com.sun.jmx.remote.internal com.sun.jmx.remote.protocol.iiop com.sun.jmx.remote.protocol.rmi com.sun.jmx.remote.security com.sun.jmx.remote.util com.sun.jmx.snmp.agent com.sun.jmx.snmp com.sun.jmx.snmp.daemon com.sun.jmx.snmp.defaults com.sun.jmx.snmp.internal com.sun.jmx.snmp.IPAcl com.sun.jmx.snmp.mpm com.sun.jmx.snmp.tasks com.sun.jmx.trace com.sun.mirror.apt com.sun.mirror.declaration com.sun.mirror.type com.sun.mirror.util com.sun.naming.internal com.sun.org.apache.bcel.internal.classfile com.sun.org.apache.bcel.internal com.sun.org.apache.bcel.internal.generic com.sun.org.apache.bcel.internal.util com.sun.org.apache.regexp.internal com.sun.org.apache.xalan.internal.extensions com.sun.org.apache.xalan.internal.lib com.sun.org.apache.xalan.internal.res com.sun.org.apache.xalan.internal.templates com.sun.org.apache.xalan.internal.utils com.sun.org.apache.xalan.internal com.sun.org.apache.xalan.internal.xslt com.sun.org.apache.xalan.internal.xsltc.cmdline com.sun.org.apache.xalan.internal.xsltc.cmdline.getopt com.sun.org.apache.xalan.internal.xsltc com.sun.org.apache.xalan.internal.xsltc.compiler com.sun.org.apache.xalan.internal.xsltc.compiler.util com.sun.org.apache.xalan.internal.xsltc.dom com.sun.org.apache.xalan.internal.xsltc.runtime com.sun.org.apache.xalan.internal.xsltc.runtime.output com.sun.org.apache.xalan.internal.xsltc.trax com.sun.org.apache.xalan.internal.xsltc.util com.sun.org.apache.xerces.internal.dom com.sun.org.apache.xerces.internal.dom.events com.sun.org.apache.xerces.internal.impl com.sun.org.apache.xerces.internal.impl.dtd com.sun.org.apache.xerces.internal.impl.dtd.models com.sun.org.apache.xerces.internal.impl.dv com.sun.org.apache.xerces.internal.impl.dv.dtd com.sun.org.apache.xerces.internal.impl.dv.util com.sun.org.apache.xerces.internal.impl.dv.xs com.sun.org.apache.xerces.internal.impl.io com.sun.org.apache.xerces.internal.impl.msg com.sun.org.apache.xerces.internal.impl.validation com.sun.org.apache.xerces.internal.impl.xpath.regex com.sun.org.apache.xerces.internal.impl.xpath com.sun.org.apache.xerces.internal.impl.xs com.sun.org.apache.xerces.internal.impl.xs.identity com.sun.org.apache.xerces.internal.impl.xs.models com.sun.org.apache.xerces.internal.impl.xs.opti com.sun.org.apache.xerces.internal.impl.xs.traversers com.sun.org.apache.xerces.internal.impl.xs.util com.sun.org.apache.xerces.internal.jaxp.datatype com.sun.org.apache.xerces.internal.jaxp com.sun.org.apache.xerces.internal.jaxp.validation com.sun.org.apache.xerces.internal.parsers com.sun.org.apache.xerces.internal.util com.sun.org.apache.xerces.internal.utils com.sun.org.apache.xerces.internal.xinclude com.sun.org.apache.xerces.internal.xni com.sun.org.apache.xerces.internal.xni.grammars com.sun.org.apache.xerces.internal.xni.parser com.sun.org.apache.xerces.internal.xpointer com.sun.org.apache.xerces.internal.xs com.sun.org.apache.xerces.internal.xs.datatypes com.sun.org.apache.xml.internal.dtm com.sun.org.apache.xml.internal.dtm.ref com.sun.org.apache.xml.internal.dtm.ref.dom2dtm com.sun.org.apache.xml.internal.dtm.ref.sax2dtm com.sun.org.apache.xml.internal.res com.sun.org.apache.xml.internal.resolver com.sun.org.apache.xml.internal.resolver.helpers com.sun.org.apache.xml.internal.resolver.readers com.sun.org.apache.xml.internal.resolver.tools com.sun.org.apache.xml.internal.security.algorithms com.sun.org.apache.xml.internal.security.algorithms.implementations com.sun.org.apache.xml.internal.security.c14n com.sun.org.apache.xml.internal.security.c14n.helper com.sun.org.apache.xml.internal.security.c14n.implementations com.sun.org.apache.xml.internal.security.encryption com.sun.org.apache.xml.internal.security.exceptions com.sun.org.apache.xml.internal.security com.sun.org.apache.xml.internal.security.keys.content com.sun.org.apache.xml.internal.security.keys.content.keyvalues com.sun.org.apache.xml.internal.security.keys.content.x509 com.sun.org.apache.xml.internal.security.keys com.sun.org.apache.xml.internal.security.keys.keyresolver.implementations com.sun.org.apache.xml.internal.security.keys.keyresolver com.sun.org.apache.xml.internal.security.keys.storage.implementations com.sun.org.apache.xml.internal.security.keys.storage com.sun.org.apache.xml.internal.security.signature com.sun.org.apache.xml.internal.security.transforms com.sun.org.apache.xml.internal.security.transforms.implementations com.sun.org.apache.xml.internal.security.transforms.params com.sun.org.apache.xml.internal.security.utils com.sun.org.apache.xml.internal.security.utils.resolver.implementations com.sun.org.apache.xml.internal.security.utils.resolver com.sun.org.apache.xml.internal.serialize com.sun.org.apache.xml.internal.serializer com.sun.org.apache.xml.internal.serializer.utils com.sun.org.apache.xml.internal.utils com.sun.org.apache.xml.internal.utils.res com.sun.org.apache.xpath.internal com.sun.org.apache.xpath.internal.axes com.sun.org.apache.xpath.internal.compiler com.sun.org.apache.xpath.internal.domapi com.sun.org.apache.xpath.internal.functions com.sun.org.apache.xpath.internal.jaxp com.sun.org.apache.xpath.internal.objects com.sun.org.apache.xpath.internal.operations com.sun.org.apache.xpath.internal.patterns com.sun.org.apache.xpath.internal.res com.sun.security.auth.callback com.sun.security.auth com.sun.security.auth.login com.sun.security.auth.module com.sun.security.jgss com.sun.source.tree com.sun.source.util java.applet java.awt java.awt.color java.awt.datatransfer java.awt.dnd java.awt.dnd.peer java.awt.event java.awt.font java.awt.geom java.awt.im java.awt.im.spi java.awt.image java.awt.image.renderable java.awt.peer java.awt.print java.beans java.beans.beancontext java.io java.lang java.lang.annotation java.lang.instrument java.lang.invoke java.lang.management java.lang.ref java.lang.reflect java.math java.net java.nio java.nio.channels java.nio.channels.spi java.nio.charset java.nio.charset.spi java.nio.file java.nio.file.attribute java.nio.file.spi java.rmi java.rmi.activation java.rmi.dgc java.rmi.registry java.rmi.server java.security java.security.acl java.security.cert java.security.interfaces java.security.spec java.sql java.text java.text.spi java.util java.util.concurrent java.util.concurrent.atomic java.util.concurrent.locks java.util.jar java.util.logging java.util.prefs java.util.regex java.util.spi java.util.zip javax.accessibility javax.annotation javax.annotation.processing javax.imageio.event javax.imageio javax.imageio.metadata javax.imageio.plugins.bmp javax.imageio.plugins.jpeg javax.imageio.spi javax.imageio.stream javax.lang.model.element javax.lang.model javax.lang.model.type javax.lang.model.util javax.management javax.management.loading javax.management.modelmbean javax.management.monitor javax.management.openmbean javax.management.relation javax.management.remote javax.management.remote.rmi javax.management.timer javax.naming javax.naming.directory javax.naming.event javax.naming.ldap javax.naming.spi javax.print.attribute javax.print.attribute.standard javax.print javax.print.event javax.rmi.CORBA javax.rmi javax.rmi.ssl javax.script javax.security.auth javax.security.auth.callback javax.security.auth.kerberos javax.security.auth.login javax.security.auth.spi javax.security.auth.x500 javax.security.cert javax.security.sasl javax.sound.midi javax.sound.midi.spi javax.sound.sampled javax.sound.sampled.spi javax.sql javax.sql.rowset javax.sql.rowset.serial javax.sql.rowset.spi javax.swing javax.swing.border javax.swing.colorchooser javax.swing.event javax.swing.filechooser javax.swing.plaf javax.swing.plaf.basic javax.swing.plaf.metal javax.swing.plaf.multi javax.swing.plaf.nimbus javax.swing.plaf.synth javax.swing.table javax.swing.text javax.swing.text.html javax.swing.text.html.parser javax.swing.text.rtf javax.swing.tree javax.swing.undo javax.tools javax.xml.bind.annotation.adapters javax.xml.bind.annotation javax.xml.bind.attachment javax.xml.bind javax.xml.bind.helpers javax.xml.bind.util javax.xml.crypto javax.xml.crypto.dom javax.xml.crypto.dsig javax.xml.crypto.dsig.dom javax.xml.crypto.dsig.keyinfo javax.xml.crypto.dsig.spec javax.xml.datatype javax.xml.namespace javax.xml.parsers javax.xml.soap javax.xml.stream javax.xml.stream.events javax.xml.stream.util javax.xml.transform.dom javax.xml.transform javax.xml.transform.sax javax.xml.transform.stax javax.xml.transform.stream javax.xml.validation javax.xml.ws javax.xml.ws.handler javax.xml.ws.handler.soap javax.xml.ws.http javax.xml.ws.soap javax.xml.ws.spi javax.xml.ws.spi.http javax.xml.ws.wsaddressing javax.xml javax.xml.xpath launcher org.ietf.jgss org.omg.CORBA org.omg.CORBA.DynAnyPackage org.omg.CORBA.ORBPackage org.omg.CORBA.portable org.omg.CORBA.TypeCodePackage org.omg.CORBA_2_3 org.omg.CORBA_2_3.portable org.omg.CosNaming org.omg.CosNaming.NamingContextExtPackage org.omg.CosNaming.NamingContextPackage org.omg.Dynamic org.omg.DynamicAny org.omg.DynamicAny.DynAnyFactoryPackage org.omg.DynamicAny.DynAnyPackage org.omg.IOP org.omg.IOP.CodecFactoryPackage org.omg.IOP.CodecPackage org.omg.Messaging org.omg.PortableInterceptor org.omg.PortableInterceptor.ORBInitInfoPackage org.omg.PortableServer org.omg.PortableServer.CurrentPackage org.omg.PortableServer.POAManagerPackage org.omg.PortableServer.POAPackage org.omg.PortableServer.portable org.omg.PortableServer.ServantLocatorPackage org.omg.SendingContext org.omg.stub.java.rmi org.w3c.dom org.w3c.dom.bootstrap org.w3c.dom.css org.w3c.dom.events org.w3c.dom.html org.w3c.dom.ls org.w3c.dom.ranges org.w3c.dom.stylesheets org.w3c.dom.traversal org.w3c.dom.views org.w3c.dom.xpath org.xml.sax org.xml.sax.ext org.xml.sax.helpers sunw.io sunw.util