Javadoc creation failes with IlegalArgumentExpection

对着背影说爱祢 提交于 2020-01-17 02:58:06

问题


I am using Netbeans and also tried Command Prompt. In both cases i get the same error.

When i try to generate my JavaDocs i get an IllegalArgumentexception. I did research and the recommendation is to Clear out your Classpath Bug Ticket

Can someone guide me as to what i am clearing and how i would do it on a Windows machine.

Using JDK 1.6 and also tested with JDK 1.7

Output from Netbeans

ant -f C:\\Users\\SomeProject javadoc
init:
Warning: Leaving out empty argument '-windowtitle'
Generating Javadoc
Javadoc execution
Loading source file C:\Users\Achievers.java...
Loading source file C:\Users\AchieversPage.java...
Constructing Javadoc information...
Standard Doclet version 1.6.0_37
Building tree for all the packages and classes...

ANT Scrict (relevant chunk)

<target depends="init" if="have.sources" name="-javadoc-build">
    <mkdir dir="${dist.javadoc.dir}"/>
    <condition else="" property="javadoc.endorsed.classpath.cmd.line.arg" value="-J${endorsed.classpath.cmd.line.arg}">
        <and>
            <isset property="endorsed.classpath.cmd.line.arg"/>
            <not>
                <equals arg1="${endorsed.classpath.cmd.line.arg}" arg2=""/>
            </not>
        </and>
    </condition>
    <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" executable="${platform.javadoc}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
        <classpath>
            <path path="${javac.classpath}"/>
        </classpath>
        <fileset dir="${src.dir}" excludes="*.java,${excludes}" includes="${includes}">
            <filename name="**/*.java"/>
        </fileset>
        <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
            <include name="**/*.java"/>
            <exclude name="*.java"/>
        </fileset>
        <arg line="${javadoc.endorsed.classpath.cmd.line.arg}"/>
    </javadoc>
    <copy todir="${dist.javadoc.dir}">
        <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
            <filename name="**/doc-files/**"/>
        </fileset>
        <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
            <include name="**/doc-files/**"/>
        </fileset>
    </copy>
</target>
<target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
    <nbbrowse file="${dist.javadoc.dir}/index.html"/>
</target>
<target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>

And the Error

java.lang.IllegalArgumentException
    at sun.net.www.ParseUtil.decode(ParseUtil.java:189)
    at sun.misc.URLClassPath$FileLoader.<init>(URLClassPath.java:958)
    at sun.misc.URLClassPath$3.run(URLClassPath.java:328)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.misc.URLClassPath.getLoader(URLClassPath.java:322)
    at sun.misc.URLClassPath.getLoader(URLClassPath.java:299)
    at sun.misc.URLClassPath.findResource(URLClassPath.java:145)
    at java.net.URLClassLoader$2.run(URLClassLoader.java:385)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findResource(URLClassLoader.java:382)
    at java.lang.ClassLoader.getResource(ClassLoader.java:1002)
    at java.lang.ClassLoader.getResourceAsStream(ClassLoader.java:1192)
    at javax.xml.parsers.SecuritySupport$4.run(SecuritySupport.java:96)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.xml.parsers.SecuritySupport.getResourceAsStream(SecuritySupport.java:89)
    at javax.xml.parsers.FactoryFinder.findJarServiceProvider(FactoryFinder.java:250)
    at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:223)
    at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:128)
    at com.sun.tools.doclets.internal.toolkit.builders.LayoutParser.parseXML(LayoutParser.java:72)
    at com.sun.tools.doclets.internal.toolkit.builders.ClassBuilder.build(ClassBuilder.java:108)
    at com.sun.tools.doclets.formats.html.HtmlDoclet.generateClassFiles(HtmlDoclet.java:155)
    at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.generateClassFiles(AbstractDoclet.java:177)
    at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.generateClassFiles(AbstractDoclet.java:161)
    at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:106)
    at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.start(AbstractDoclet.java:64)
    at com.sun.tools.doclets.formats.html.HtmlDoclet.start(HtmlDoclet.java:42)
    at com.sun.tools.doclets.standard.Standard.start(Standard.java:23)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:269)
    at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:143)
    at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:340)
    at com.sun.tools.javadoc.Start.begin(Start.java:128)
    at com.sun.tools.javadoc.Main.execute(Main.java:41)
    at com.sun.tools.javadoc.Main.main(Main.java:31)
com.sun.tools.doclets.internal.toolkit.util.DocletAbortException
    at com.sun.tools.doclets.internal.toolkit.builders.LayoutParser.parseXML(LayoutParser.java:79)
    at com.sun.tools.doclets.internal.toolkit.builders.ClassBuilder.build(ClassBuilder.java:108)
    at com.sun.tools.doclets.formats.html.HtmlDoclet.generateClassFiles(HtmlDoclet.java:155)
    at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.generateClassFiles(AbstractDoclet.java:177)
    at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.generateClassFiles(AbstractDoclet.java:161)
    at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:106)
    at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.start(AbstractDoclet.java:64)
    at com.sun.tools.doclets.formats.html.HtmlDoclet.start(HtmlDoclet.java:42)
    at com.sun.tools.doclets.standard.Standard.start(Standard.java:23)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:269)
    at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:143)
    at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:340)
    at com.sun.tools.javadoc.Start.begin(Start.java:128)
    at com.sun.tools.javadoc.Main.execute(Main.java:41)
    at com.sun.tools.javadoc.Main.main(Main.java:31)
com.sun.tools.doclets.internal.toolkit.util.DocletAbortException
    at com.sun.tools.doclets.formats.html.HtmlDoclet.generateClassFiles(HtmlDoclet.java:159)
    at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.generateClassFiles(AbstractDoclet.java:177)
    at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.generateClassFiles(AbstractDoclet.java:161)
    at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:106)
    at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.start(AbstractDoclet.java:64)
    at com.sun.tools.doclets.formats.html.HtmlDoclet.start(HtmlDoclet.java:42)
    at com.sun.tools.doclets.standard.Standard.start(Standard.java:23)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:269)
    at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:143)
    at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:340)
    at com.sun.tools.javadoc.Start.begin(Start.java:128)
    at com.sun.tools.javadoc.Main.execute(Main.java:41)
    at com.sun.tools.javadoc.Main.main(Main.java:31)
C:\Users\SomeProject\nbproject\build-impl.xml:1228: Javadoc returned 1

回答1:


Answer was simple

1) Open Command Promt

2) type the following to clear the classpath

set classpath=

3) In the same command prompt window run Javadoc command

javadoc -d <path to save docs to> -sourcepath <location of code/files> <package name>


来源:https://stackoverflow.com/questions/24636215/javadoc-creation-failes-with-ilegalargumentexpection

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!