博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[注意事项&车轮]java源代码 产生局部javadoc api档
阅读量:5360 次
发布时间:2019-06-15

本文共 14357 字,大约阅读时间需要 47 分钟。

随着Eclipse书写java码时间,有时候,因为我们不知道java函数返回。通过鼠标移动到java该功能,假设它javadoc相关内容将被显示。

但是,并非所有java代码javadoc;连装javadoc。于eclipse假设没有设置。使用。

我在win7下安装的是javase的jdk。发现eclipse中默认的javadoc路径是http://download.oracle.com/javase/7/docs/api/,显然这是一个在线资源。问题是网络总是不稳定的,有时候看不到相应的文档内容。

so,what should we do?and what can we do?!

一个显而易见的解决方法是下载javadoc并在本地安装。然后在eclipse中改动javadoc的路径。可是,为什么要下载javadoc?不是有一个命令也叫javadoc的么?不能用么?在java安装路径下能够找到一个叫src.zip的压缩包,里面是java的源代码,并且有凝视,应该能够生成javadoc的。到oracle官方上看了一下。发现javase版本号的jdk就是不带文档的,而javaee版本号的jdk却带文档。好吧,反正我对oracle没有什么好感。对此我仅仅能呵呵。

怎样手动生成本地javadoc api文档?对于jdk中的java源代码,由于包括太多的包,因此须要统计全部使用到的包。也就是“当前路径下包括java文件的全部目录”。

ok。由于google不能用。百度出来的结果基本上是没參考价值,唯一实用的一个是分析swf源代码的样例,够了。通过获取全部包的路径并存储在一个叫package.txt的文件里。并存储在java源代码解压后的路径src下,然后执行cmd。cd到src路径,输入javadoc javadoc -d api @package.txt命令,静候5分钟,文档就会生成完成!

然后我们也能够通过chrome打开。比方JComponent.html页面:

附:用来获取java源代码中全部包括java文件的文件夹的代码:

package util;import java.io.File;import java.util.Vector;public class SniffDir {	private String srcDir;	private Vector
vs; public SniffDir(){ srcDir="D:/workspace/src"; vs=new Vector
(); } /** * 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(); } }

获取的结果(存储在package.txt中并放到src文件夹下就可以):

com.sun.corba.se.impl.activationcom.sun.corba.se.impl.copyobjectcom.sun.corba.se.impl.corbacom.sun.corba.se.impl.dynamicanycom.sun.corba.se.impl.encodingcom.sun.corba.se.impl.interceptorscom.sun.corba.se.impl.iocom.sun.corba.se.impl.iorcom.sun.corba.se.impl.ior.iiopcom.sun.corba.se.impl.javax.rmi.CORBAcom.sun.corba.se.impl.javax.rmicom.sun.corba.se.impl.legacy.connectioncom.sun.corba.se.impl.loggingcom.sun.corba.se.impl.monitoringcom.sun.corba.se.impl.naming.cosnamingcom.sun.corba.se.impl.naming.namingutilcom.sun.corba.se.impl.naming.pcosnamingcom.sun.corba.se.impl.oacom.sun.corba.se.impl.oa.poacom.sun.corba.se.impl.oa.toacom.sun.corba.se.impl.orbcom.sun.corba.se.impl.orbutilcom.sun.corba.se.impl.orbutil.closurecom.sun.corba.se.impl.orbutil.concurrentcom.sun.corba.se.impl.orbutil.fsmcom.sun.corba.se.impl.orbutil.graphcom.sun.corba.se.impl.orbutil.threadpoolcom.sun.corba.se.impl.presentation.rmicom.sun.corba.se.impl.protocolcom.sun.corba.se.impl.protocol.giopmsgheaderscom.sun.corba.se.impl.resolvercom.sun.corba.se.impl.transportcom.sun.corba.se.impl.utilcom.sun.corba.se.internal.corbacom.sun.corba.se.internal.CosNamingcom.sun.corba.se.internal.iiopcom.sun.corba.se.internal.Interceptorscom.sun.corba.se.internal.POAcom.sun.corba.se.org.omg.CORBAcom.sun.corba.se.pept.brokercom.sun.corba.se.pept.encodingcom.sun.corba.se.pept.protocolcom.sun.corba.se.pept.transportcom.sun.corba.se.PortableActivationIDLcom.sun.corba.se.PortableActivationIDL.InitialNameServicePackagecom.sun.corba.se.PortableActivationIDL.LocatorPackagecom.sun.corba.se.PortableActivationIDL.RepositoryPackagecom.sun.corba.se.spi.activationcom.sun.corba.se.spi.activation.InitialNameServicePackagecom.sun.corba.se.spi.activation.LocatorPackagecom.sun.corba.se.spi.activation.RepositoryPackagecom.sun.corba.se.spi.copyobjectcom.sun.corba.se.spi.encodingcom.sun.corba.se.spi.extensioncom.sun.corba.se.spi.iorcom.sun.corba.se.spi.ior.iiopcom.sun.corba.se.spi.legacy.connectioncom.sun.corba.se.spi.legacy.interceptorcom.sun.corba.se.spi.loggingcom.sun.corba.se.spi.monitoringcom.sun.corba.se.spi.oacom.sun.corba.se.spi.orbcom.sun.corba.se.spi.orbutil.closurecom.sun.corba.se.spi.orbutil.fsmcom.sun.corba.se.spi.orbutil.proxycom.sun.corba.se.spi.orbutil.threadpoolcom.sun.corba.se.spi.presentation.rmicom.sun.corba.se.spi.protocolcom.sun.corba.se.spi.resolvercom.sun.corba.se.spi.servicecontextcom.sun.corba.se.spi.transportcom.sun.image.codec.jpegcom.sun.imageio.plugins.bmpcom.sun.imageio.plugins.commoncom.sun.imageio.plugins.gifcom.sun.imageio.plugins.jpegcom.sun.imageio.plugins.pngcom.sun.imageio.plugins.wbmpcom.sun.imageio.spicom.sun.imageio.streamcom.sun.java.swingcom.sun.java.swing.plaf.gtkcom.sun.java.swing.plaf.motifcom.sun.java.swing.plaf.motif.resourcescom.sun.java.swing.plaf.nimbuscom.sun.java.swing.plaf.windowscom.sun.java.swing.plaf.windows.resourcescom.sun.javadoccom.sun.java_cup.internal.runtimecom.sun.jmx.defaultscom.sun.jmx.interceptorcom.sun.jmx.mbeanservercom.sun.jmx.remote.internalcom.sun.jmx.remote.protocol.iiopcom.sun.jmx.remote.protocol.rmicom.sun.jmx.remote.securitycom.sun.jmx.remote.utilcom.sun.jmx.snmp.agentcom.sun.jmx.snmpcom.sun.jmx.snmp.daemoncom.sun.jmx.snmp.defaultscom.sun.jmx.snmp.internalcom.sun.jmx.snmp.IPAclcom.sun.jmx.snmp.mpmcom.sun.jmx.snmp.taskscom.sun.jmx.tracecom.sun.mirror.aptcom.sun.mirror.declarationcom.sun.mirror.typecom.sun.mirror.utilcom.sun.naming.internalcom.sun.org.apache.bcel.internal.classfilecom.sun.org.apache.bcel.internalcom.sun.org.apache.bcel.internal.genericcom.sun.org.apache.bcel.internal.utilcom.sun.org.apache.regexp.internalcom.sun.org.apache.xalan.internal.extensionscom.sun.org.apache.xalan.internal.libcom.sun.org.apache.xalan.internal.rescom.sun.org.apache.xalan.internal.templatescom.sun.org.apache.xalan.internal.utilscom.sun.org.apache.xalan.internalcom.sun.org.apache.xalan.internal.xsltcom.sun.org.apache.xalan.internal.xsltc.cmdlinecom.sun.org.apache.xalan.internal.xsltc.cmdline.getoptcom.sun.org.apache.xalan.internal.xsltccom.sun.org.apache.xalan.internal.xsltc.compilercom.sun.org.apache.xalan.internal.xsltc.compiler.utilcom.sun.org.apache.xalan.internal.xsltc.domcom.sun.org.apache.xalan.internal.xsltc.runtimecom.sun.org.apache.xalan.internal.xsltc.runtime.outputcom.sun.org.apache.xalan.internal.xsltc.traxcom.sun.org.apache.xalan.internal.xsltc.utilcom.sun.org.apache.xerces.internal.domcom.sun.org.apache.xerces.internal.dom.eventscom.sun.org.apache.xerces.internal.implcom.sun.org.apache.xerces.internal.impl.dtdcom.sun.org.apache.xerces.internal.impl.dtd.modelscom.sun.org.apache.xerces.internal.impl.dvcom.sun.org.apache.xerces.internal.impl.dv.dtdcom.sun.org.apache.xerces.internal.impl.dv.utilcom.sun.org.apache.xerces.internal.impl.dv.xscom.sun.org.apache.xerces.internal.impl.iocom.sun.org.apache.xerces.internal.impl.msgcom.sun.org.apache.xerces.internal.impl.validationcom.sun.org.apache.xerces.internal.impl.xpath.regexcom.sun.org.apache.xerces.internal.impl.xpathcom.sun.org.apache.xerces.internal.impl.xscom.sun.org.apache.xerces.internal.impl.xs.identitycom.sun.org.apache.xerces.internal.impl.xs.modelscom.sun.org.apache.xerces.internal.impl.xs.opticom.sun.org.apache.xerces.internal.impl.xs.traverserscom.sun.org.apache.xerces.internal.impl.xs.utilcom.sun.org.apache.xerces.internal.jaxp.datatypecom.sun.org.apache.xerces.internal.jaxpcom.sun.org.apache.xerces.internal.jaxp.validationcom.sun.org.apache.xerces.internal.parserscom.sun.org.apache.xerces.internal.utilcom.sun.org.apache.xerces.internal.utilscom.sun.org.apache.xerces.internal.xincludecom.sun.org.apache.xerces.internal.xnicom.sun.org.apache.xerces.internal.xni.grammarscom.sun.org.apache.xerces.internal.xni.parsercom.sun.org.apache.xerces.internal.xpointercom.sun.org.apache.xerces.internal.xscom.sun.org.apache.xerces.internal.xs.datatypescom.sun.org.apache.xml.internal.dtmcom.sun.org.apache.xml.internal.dtm.refcom.sun.org.apache.xml.internal.dtm.ref.dom2dtmcom.sun.org.apache.xml.internal.dtm.ref.sax2dtmcom.sun.org.apache.xml.internal.rescom.sun.org.apache.xml.internal.resolvercom.sun.org.apache.xml.internal.resolver.helperscom.sun.org.apache.xml.internal.resolver.readerscom.sun.org.apache.xml.internal.resolver.toolscom.sun.org.apache.xml.internal.security.algorithmscom.sun.org.apache.xml.internal.security.algorithms.implementationscom.sun.org.apache.xml.internal.security.c14ncom.sun.org.apache.xml.internal.security.c14n.helpercom.sun.org.apache.xml.internal.security.c14n.implementationscom.sun.org.apache.xml.internal.security.encryptioncom.sun.org.apache.xml.internal.security.exceptionscom.sun.org.apache.xml.internal.securitycom.sun.org.apache.xml.internal.security.keys.contentcom.sun.org.apache.xml.internal.security.keys.content.keyvaluescom.sun.org.apache.xml.internal.security.keys.content.x509com.sun.org.apache.xml.internal.security.keyscom.sun.org.apache.xml.internal.security.keys.keyresolver.implementationscom.sun.org.apache.xml.internal.security.keys.keyresolvercom.sun.org.apache.xml.internal.security.keys.storage.implementationscom.sun.org.apache.xml.internal.security.keys.storagecom.sun.org.apache.xml.internal.security.signaturecom.sun.org.apache.xml.internal.security.transformscom.sun.org.apache.xml.internal.security.transforms.implementationscom.sun.org.apache.xml.internal.security.transforms.paramscom.sun.org.apache.xml.internal.security.utilscom.sun.org.apache.xml.internal.security.utils.resolver.implementationscom.sun.org.apache.xml.internal.security.utils.resolvercom.sun.org.apache.xml.internal.serializecom.sun.org.apache.xml.internal.serializercom.sun.org.apache.xml.internal.serializer.utilscom.sun.org.apache.xml.internal.utilscom.sun.org.apache.xml.internal.utils.rescom.sun.org.apache.xpath.internalcom.sun.org.apache.xpath.internal.axescom.sun.org.apache.xpath.internal.compilercom.sun.org.apache.xpath.internal.domapicom.sun.org.apache.xpath.internal.functionscom.sun.org.apache.xpath.internal.jaxpcom.sun.org.apache.xpath.internal.objectscom.sun.org.apache.xpath.internal.operationscom.sun.org.apache.xpath.internal.patternscom.sun.org.apache.xpath.internal.rescom.sun.security.auth.callbackcom.sun.security.authcom.sun.security.auth.logincom.sun.security.auth.modulecom.sun.security.jgsscom.sun.source.treecom.sun.source.utiljava.appletjava.awtjava.awt.colorjava.awt.datatransferjava.awt.dndjava.awt.dnd.peerjava.awt.eventjava.awt.fontjava.awt.geomjava.awt.imjava.awt.im.spijava.awt.imagejava.awt.image.renderablejava.awt.peerjava.awt.printjava.beansjava.beans.beancontextjava.iojava.langjava.lang.annotationjava.lang.instrumentjava.lang.invokejava.lang.managementjava.lang.refjava.lang.reflectjava.mathjava.netjava.niojava.nio.channelsjava.nio.channels.spijava.nio.charsetjava.nio.charset.spijava.nio.filejava.nio.file.attributejava.nio.file.spijava.rmijava.rmi.activationjava.rmi.dgcjava.rmi.registryjava.rmi.serverjava.securityjava.security.acljava.security.certjava.security.interfacesjava.security.specjava.sqljava.textjava.text.spijava.utiljava.util.concurrentjava.util.concurrent.atomicjava.util.concurrent.locksjava.util.jarjava.util.loggingjava.util.prefsjava.util.regexjava.util.spijava.util.zipjavax.accessibilityjavax.annotationjavax.annotation.processingjavax.imageio.eventjavax.imageiojavax.imageio.metadatajavax.imageio.plugins.bmpjavax.imageio.plugins.jpegjavax.imageio.spijavax.imageio.streamjavax.lang.model.elementjavax.lang.modeljavax.lang.model.typejavax.lang.model.utiljavax.managementjavax.management.loadingjavax.management.modelmbeanjavax.management.monitorjavax.management.openmbeanjavax.management.relationjavax.management.remotejavax.management.remote.rmijavax.management.timerjavax.namingjavax.naming.directoryjavax.naming.eventjavax.naming.ldapjavax.naming.spijavax.print.attributejavax.print.attribute.standardjavax.printjavax.print.eventjavax.rmi.CORBAjavax.rmijavax.rmi.ssljavax.scriptjavax.security.authjavax.security.auth.callbackjavax.security.auth.kerberosjavax.security.auth.loginjavax.security.auth.spijavax.security.auth.x500javax.security.certjavax.security.sasljavax.sound.midijavax.sound.midi.spijavax.sound.sampledjavax.sound.sampled.spijavax.sqljavax.sql.rowsetjavax.sql.rowset.serialjavax.sql.rowset.spijavax.swingjavax.swing.borderjavax.swing.colorchooserjavax.swing.eventjavax.swing.filechooserjavax.swing.plafjavax.swing.plaf.basicjavax.swing.plaf.metaljavax.swing.plaf.multijavax.swing.plaf.nimbusjavax.swing.plaf.synthjavax.swing.tablejavax.swing.textjavax.swing.text.htmljavax.swing.text.html.parserjavax.swing.text.rtfjavax.swing.treejavax.swing.undojavax.toolsjavax.xml.bind.annotation.adaptersjavax.xml.bind.annotationjavax.xml.bind.attachmentjavax.xml.bindjavax.xml.bind.helpersjavax.xml.bind.utiljavax.xml.cryptojavax.xml.crypto.domjavax.xml.crypto.dsigjavax.xml.crypto.dsig.domjavax.xml.crypto.dsig.keyinfojavax.xml.crypto.dsig.specjavax.xml.datatypejavax.xml.namespacejavax.xml.parsersjavax.xml.soapjavax.xml.streamjavax.xml.stream.eventsjavax.xml.stream.utiljavax.xml.transform.domjavax.xml.transformjavax.xml.transform.saxjavax.xml.transform.staxjavax.xml.transform.streamjavax.xml.validationjavax.xml.wsjavax.xml.ws.handlerjavax.xml.ws.handler.soapjavax.xml.ws.httpjavax.xml.ws.soapjavax.xml.ws.spijavax.xml.ws.spi.httpjavax.xml.ws.wsaddressingjavax.xmljavax.xml.xpathlauncherorg.ietf.jgssorg.omg.CORBAorg.omg.CORBA.DynAnyPackageorg.omg.CORBA.ORBPackageorg.omg.CORBA.portableorg.omg.CORBA.TypeCodePackageorg.omg.CORBA_2_3org.omg.CORBA_2_3.portableorg.omg.CosNamingorg.omg.CosNaming.NamingContextExtPackageorg.omg.CosNaming.NamingContextPackageorg.omg.Dynamicorg.omg.DynamicAnyorg.omg.DynamicAny.DynAnyFactoryPackageorg.omg.DynamicAny.DynAnyPackageorg.omg.IOPorg.omg.IOP.CodecFactoryPackageorg.omg.IOP.CodecPackageorg.omg.Messagingorg.omg.PortableInterceptororg.omg.PortableInterceptor.ORBInitInfoPackageorg.omg.PortableServerorg.omg.PortableServer.CurrentPackageorg.omg.PortableServer.POAManagerPackageorg.omg.PortableServer.POAPackageorg.omg.PortableServer.portableorg.omg.PortableServer.ServantLocatorPackageorg.omg.SendingContextorg.omg.stub.java.rmiorg.w3c.domorg.w3c.dom.bootstraporg.w3c.dom.cssorg.w3c.dom.eventsorg.w3c.dom.htmlorg.w3c.dom.lsorg.w3c.dom.rangesorg.w3c.dom.stylesheetsorg.w3c.dom.traversalorg.w3c.dom.viewsorg.w3c.dom.xpathorg.xml.saxorg.xml.sax.extorg.xml.sax.helperssunw.iosunw.util

版权声明:本文博主原创文章,博客,未经同意不得转载。

转载于:https://www.cnblogs.com/mengfanrong/p/4853215.html

你可能感兴趣的文章
thinkphp如何实现伪静态
查看>>
BZOJ 2243: [SDOI2011]染色( 树链剖分 )
查看>>
BZOJ 1925: [Sdoi2010]地精部落( dp )
查看>>
c++中的string常用函数用法总结!
查看>>
[DLX精确覆盖+打表] hdu 2518 Dominoes
查看>>
SuperMap iServerJava 6R扩展领域开发及压力测试---判断点在那个面内(1)
查看>>
Week03-面向对象入门
查看>>
一个控制台程序,模拟机器人对话
查看>>
Vue 2.x + Webpack 3.x + Nodejs 多页面项目框架(上篇——纯前端多页面)
查看>>
我的PHP学习之路
查看>>
【题解】luogu p2340 奶牛会展
查看>>
对PostgreSQL的 SPI_prepare 的理解。
查看>>
解决响应式布局下兼容性的问题
查看>>
使用DBCP连接池对连接进行管理
查看>>
【洛谷】【堆+模拟】P2278 操作系统
查看>>
hdu3307 欧拉函数
查看>>
Spring Bean InitializingBean和DisposableBean实例
查看>>
[容斥][dp][快速幂] Jzoj P5862 孤独
查看>>
Lucene 学习之二:数值类型的索引和范围查询分析
查看>>
软件开发工作模型
查看>>