javadoc コメント付きクラスのいずれかの javadoc をエクスポートまたは生成しようとすると、最近まで完全に空の html ファイルが生成されるまで、常にエラーが発生していました。
これは私が以前に受け取っていたエラーです:
Constructing Javadoc information...
Standard Doclet version 1.7.0_03
Building tree for all the packages and classes...
Generating C:\Users\James\Workspace\TestCLASS.html.…
java.lang.IllegalArgumentException
at sun.net.www.ParseUtil.decode(ParseUtil.j…
at sun.misc.URLClassPath$FileLoader.<init>(…
at sun.misc.URLClassPath$3.run(URLClassPath…
at sun.misc.URLClassPath$3.run(URLClassPath…
at java.security.AccessController.doPrivile… Method)
at sun.misc.URLClassPath.getLoader(URLClass…
at sun.misc.URLClassPath.getLoader(URLClass…
at sun.misc.URLClassPath.findResource(URLCl…
at java.net.URLClassLoader$2.run(URLClassLo…
at java.net.URLClassLoader$2.run(URLClassLo…
at java.security.AccessController.doPrivile… Method)
at java.net.URLClassLoader.findResource(URL…
at java.lang.ClassLoader.getResource(ClassL…
at java.net.URLClassLoader.getResourceAsStr…
at javax.xml.parsers.SecuritySupport$4.run(…
at java.security.AccessController.doPrivile… Method)
at javax.xml.parsers.SecuritySupport.getRes…
at javax.xml.parsers.FactoryFinder.findJarS…
at javax.xml.parsers.FactoryFinder.find(Fac…
at javax.xml.parsers.SAXParserFactory.newIn…
at com.sun.tools.doclets.internal.toolkit.b…
at com.sun.tools.doclets.internal.toolkit.b…
at com.sun.tools.doclets.formats.html.HtmlD…
at com.sun.tools.doclets.internal.toolkit.A…
at com.sun.tools.doclets.internal.toolkit.A…
at com.sun.tools.doclets.internal.toolkit.A…
at com.sun.tools.doclets.internal.toolkit.A…
at com.sun.tools.doclets.formats.html.HtmlD…
at com.sun.tools.doclets.standard.Standard.…
at sun.reflect.NativeMethodAccessorImpl.inv… Method)
at sun.reflect.NativeMethodAccessorImpl.inv…
at sun.reflect.DelegatingMethodAccessorImpl…
at java.lang.reflect.Method.invoke(Method.j…
at com.sun.tools.javadoc.DocletInvoker.invo…
at com.sun.tools.javadoc.DocletInvoker.star…
at com.sun.tools.javadoc.Start.parseAndExec…
at com.sun.tools.javadoc.Start.begin(Start.…
at com.sun.tools.javadoc.Main.execute(Main.…
at com.sun.tools.javadoc.Main.main(Main.jav…
com.sun.tools.doclets.internal.toolkit…
at com.sun.tools.doclets.internal.toolkit.b…
at com.sun.tools.doclets.internal.toolkit.b…
at com.sun.tools.doclets.formats.html.HtmlD…
at com.sun.tools.doclets.internal.toolkit.A…
at com.sun.tools.doclets.internal.toolkit.A…
at com.sun.tools.doclets.internal.toolkit.A…
at com.sun.tools.doclets.internal.toolkit.A…
at com.sun.tools.doclets.formats.html.HtmlD…
at com.sun.tools.doclets.standard.Standard.…
at sun.reflect.NativeMethodAccessorImpl.inv… Method)
at sun.reflect.NativeMethodAccessorImpl.inv…
at sun.reflect.DelegatingMethodAccessorImpl…
at java.lang.reflect.Method.invoke(Method.j…
at com.sun.tools.javadoc.DocletInvoker.invo…
at com.sun.tools.javadoc.DocletInvoker.star…
at com.sun.tools.javadoc.Start.parseAndExec…
at com.sun.tools.javadoc.Start.begin(Start.…
at com.sun.tools.javadoc.Main.execute(Main.…
at com.sun.tools.javadoc.Main.main(Main.jav…
com.sun.tools.doclets.internal.toolkit…
at com.sun.tools.doclets.formats.html.HtmlD…
ワークスペースのdocsという名前のフォルダーにhtmlファイルを配置するようにウィザードに指示し始めた頃に、このエラーが停止したと思います。残念ながら、このフォルダーには、プロジェクト内のクラスの1つの名前で空のhtmlファイルが1つだけあります(通常は Stack.html または Entry.html)
また、残念ながら TestClass クラスは単なるテストだったので削除しましたが、javadoc を生成できない Stack クラスは次のとおりです。
/**
* Provides the Classes necessary to create a Stack data structure.
*/
package courseworkone;
import java.util.ArrayList;
/**
* Created on 22 Oct, 2012.
*
* @author James
*/
public class Stack {
/**
* The dynamic array into which elements of the Stack are held.
*/
private ArrayList<Entry> array;
/**
* The size of the Stack (The number of elements on the stack).
*/
private int size;
/**
* Constructs an empty Stack with an initial size of 0.
*/
public Stack() {
array = new ArrayList<Entry>();
size = 0;
}
/**
* Checks the number of elements in the stack.
*
* @return the number of elements in the stack
*/
public final int size() {
return size;
}
/**
* Adds an element to the stack, and increases the stack size by 1.
*
* @param i
* The element to be added to the stack
*/
public final void push(final Entry i) {
// adds the Entry to the stack
array.add(i);
// increments the stack size by one
size++;
}
/**
* Returns the element on the top of the stack.
*
* @return the top element in the stack
*/
public final Entry top() {
// gets the element at the end of the ArrayList (top element) and
// returns it
return array.get(size - 1);
}
/**
* Returns the element on the top of the stack and then removes that element
* from the stack.
*
* @return the top element in the stack
*/
public final Entry pop() {
// stores the element at the end of the ArrayList in a temporary
// variable
Entry mostRecentEntry = array.get(size - 1);
// removes the element from the end of the ArrayList
array.remove(size - 1);
// decrements the size of the stack by one
size--;
// returns the element at the end of the ArrayList
return mostRecentEntry;
}
}
また、javadoc ウィザードを使用して、javadoc エクスポートの設定を Ant スクリプトとして保存しました。その内容は次のとおりです。
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project default="javadoc">
<target name="javadoc">
<javadoc access="public" author="true" classpath="C:\Users\James\Documents\Eclipse\plugins\org.hamcrest.core_1.1.0.v20090501071000.jar;C:\Users\James\Documents\Eclipse\plugins\org.junit_4.10.0.v4_10_0_v20120426-0900\junit.jar" destdir="C:\Users\James\workspace\docs" doctitle="Stack Implementation" nodeprecated="false" nodeprecatedlist="false" noindex="false" nonavbar="false" notree="false" packagenames="courseworkone,testcourseworkone" source="1.7" sourcepath="src;test" splitindex="true" use="true" version="true"/>
</target>
</project>
Ant ビルド実行からのコンソール出力は次のとおりです。
Apache Ant(TM) version 1.8.3 compiled on February 26 2012
Apache Ant(TM) version 1.8.3 compiled on February 26 2012
Setting ro project property: ant.file -> C:\Users\James\workspace\2ndYearWork\SoftEngCoursework1\javadoc.xml
Buildfile: C:\Users\James\workspace\2ndYearWork\SoftEngCoursework1\javadoc.xml
Adding reference: ant.projectHelper
Adding reference: ant.parsing.context
Adding reference: ant.targets
parsing buildfile C:\Users\James\workspace\2ndYearWork\SoftEngCoursework1\javadoc.xml with URI = file:/C:/Users/James/workspace/2ndYearWork/SoftEngCoursework1/javadoc.xml
Setting ro project property: ant.project.default-target -> javadoc
Project base dir set to: C:\Users\James\workspace\2ndYearWork\SoftEngCoursework1
+Target:
+Target: javadoc
Adding reference: ant.LocalProperties
Setting ro project property: ant.project.invoked-targets -> javadoc
Adding reference: eclipse.ant.targetVector
Build sequence for target(s) `javadoc' is [javadoc]
Complete build sequence is [javadoc, ]
javadoc:
parsing buildfile jar:file:/C:/Users/James/Documents/Eclipse/plugins/org.apache.ant_1.8.3.v20120321-1730/lib/ant.jar!/org/apache/tools/ant/antlib.xml with URI = jar:file:/C:/Users/James/Documents/Eclipse/plugins/org.apache.ant_1.8.3.v20120321-1730/lib/ant.jar!/org/apache/tools/ant/antlib.xml from a zip file
[javadoc] scanning C:\Users\James\workspace\2ndYearWork\SoftEngCoursework1\src for packages.
dirset: Setup scanner in dir C:\Users\James\workspace\2ndYearWork\SoftEngCoursework1\src with patternSet{ includes: [courseworkone, testcourseworkone] excludes: [] }
[javadoc] scanning C:\Users\James\workspace\2ndYearWork\SoftEngCoursework1\test for packages.
dirset: Setup scanner in dir C:\Users\James\workspace\2ndYearWork\SoftEngCoursework1\test with patternSet{ includes: [courseworkone, testcourseworkone] excludes: [] }
[javadoc] Generating Javadoc
[javadoc] Executing 'C:\Program Files (x86)\Java\jdk1.7.0_03\bin\javadoc.exe' with arguments:
[javadoc] '-public'
[javadoc] '-d'
[javadoc] 'C:\Users\James\workspace\docs'
[javadoc] '-splitindex'
[javadoc] '-use'
[javadoc] '-doctitle'
[javadoc] 'Stack Implementation'
[javadoc] '-classpath'
[javadoc] 'C:\Users\James\Documents\Eclipse\plugins\org.hamcrest.core_1.1.0.v20090501071000.jar;C:\Users\James\Documents\Eclipse\plugins\org.junit_4.10.0.v4_10_0_v20120426-0900\junit.jar'
[javadoc] '-version'
[javadoc] '-author'
[javadoc] '-sourcepath'
[javadoc] 'C:\Users\James\workspace\2ndYearWork\SoftEngCoursework1\src;C:\Users\James\workspace\2ndYearWork\SoftEngCoursework1\test'
[javadoc] '-source'
[javadoc] '1.7'
[javadoc] 'courseworkone'
[javadoc] 'testcourseworkone'
[javadoc]
[javadoc] The ' characters around the executable and arguments are
[javadoc] not part of the command.
[javadoc] Javadoc execution
Execute:Java13CommandLauncher: Executing 'C:\Program Files (x86)\Java\jdk1.7.0_03\bin\javadoc.exe' with arguments:
'-public'
'-d'
'C:\Users\James\workspace\docs'
'-splitindex'
'-use'
'-doctitle'
'Stack Implementation'
'-classpath'
'C:\Users\James\Documents\Eclipse\plugins\org.hamcrest.core_1.1.0.v20090501071000.jar;C:\Users\James\Documents\Eclipse\plugins\org.junit_4.10.0.v4_10_0_v20120426-0900\junit.jar'
'-version'
'-author'
'-sourcepath'
'C:\Users\James\workspace\2ndYearWork\SoftEngCoursework1\src;C:\Users\James\workspace\2ndYearWork\SoftEngCoursework1\test'
'-source'
'1.7'
'courseworkone'
'testcourseworkone'
The ' characters around the executable and arguments are
not part of the command.
[javadoc] Loading source files for package courseworkone...
[javadoc] Loading source files for package testcourseworkone...
[javadoc] Constructing Javadoc information...
[javadoc] Standard Doclet version 1.7.0_03
[javadoc] Building tree for all the packages and classes...
[javadoc] java.lang.IllegalArgumentException
[javadoc] at sun.net.www.ParseUtil.decode(ParseUtil.java:202)
[javadoc] at sun.misc.URLClassPath$FileLoader.<init>(URLClassPath.java:1016)
[javadoc] at sun.misc.URLClassPath$3.run(URLClassPath.java:357)
[javadoc] at sun.misc.URLClassPath$3.run(URLClassPath.java:352)
[javadoc] at java.security.AccessController.doPrivileged(Native Method)
[javadoc] at sun.misc.URLClassPath.getLoader(URLClassPath.java:351)
[javadoc] at sun.misc.URLClassPath.getLoader(URLClassPath.java:328)
[javadoc] at sun.misc.URLClassPath.findResource(URLClassPath.java:171)
[javadoc] at java.net.URLClassLoader$2.run(URLClassLoader.java:551)
[javadoc] at java.net.URLClassLoader$2.run(URLClassLoader.java:549)
[javadoc] at java.security.AccessController.doPrivileged(Native Method)
[javadoc] at java.net.URLClassLoader.findResource(URLClassLoader.java:548)
[javadoc] at java.lang.ClassLoader.getResource(ClassLoader.java:1138)
[javadoc] at java.net.URLClassLoader.getResourceAsStream(URLClassLoader.java:227)
[javadoc] at javax.xml.parsers.SecuritySupport$4.run(SecuritySupport.java:94)
[javadoc] at java.security.AccessController.doPrivileged(Native Method)
[javadoc] at javax.xml.parsers.SecuritySupport.getResourceAsStream(SecuritySupport.java:87)
[javadoc] at javax.xml.parsers.FactoryFinder.findJarServiceProvider(FactoryFinder.java:248)
[javadoc] at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:221)
[javadoc] at javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:126)
[javadoc] at com.sun.tools.doclets.internal.toolkit.builders.LayoutParser.parseXML(LayoutParser.java:88)
[javadoc] at com.sun.tools.doclets.internal.toolkit.builders.ClassBuilder.build(ClassBuilder.java:117)
[javadoc] at com.sun.tools.doclets.formats.html.HtmlDoclet.generateClassFiles(HtmlDoclet.java:186)
[javadoc] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.generateClassFiles(AbstractDoclet.java:183)
[javadoc] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:125)
[javadoc] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.start(AbstractDoclet.java:83)
[javadoc] at com.sun.tools.doclets.formats.html.HtmlDoclet.start(HtmlDoclet.java:63)
[javadoc] at com.sun.tools.doclets.standard.Standard.start(Standard.java:39)
[javadoc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[javadoc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[javadoc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[javadoc] at java.lang.reflect.Method.invoke(Method.java:601)
[javadoc] at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:280)
[javadoc] at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:160)
[javadoc] at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:397)
[javadoc] at com.sun.tools.javadoc.Start.begin(Start.java:167)
[javadoc] at com.sun.tools.javadoc.Main.execute(Main.java:59)
[javadoc] at com.sun.tools.javadoc.Main.main(Main.java:49)
[javadoc] com.sun.tools.doclets.internal.toolkit.util.DocletAbortException
[javadoc] at com.sun.tools.doclets.internal.toolkit.builders.LayoutParser.parseXML(LayoutParser.java:95)
[javadoc] at com.sun.tools.doclets.internal.toolkit.builders.ClassBuilder.build(ClassBuilder.java:117)
[javadoc] at com.sun.tools.doclets.formats.html.HtmlDoclet.generateClassFiles(HtmlDoclet.java:186)
[javadoc] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.generateClassFiles(AbstractDoclet.java:183)
[javadoc] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:125)
[javadoc] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.start(AbstractDoclet.java:83)
[javadoc] at com.sun.tools.doclets.formats.html.HtmlDoclet.start(HtmlDoclet.java:63)
[javadoc] at com.sun.tools.doclets.standard.Standard.start(Standard.java:39)
[javadoc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[javadoc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[javadoc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[javadoc] at java.lang.reflect.Method.invoke(Method.java:601)
[javadoc] at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:280)
[javadoc] at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:160)
[javadoc] at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:397)
[javadoc] at com.sun.tools.javadoc.Start.begin(Start.java:167)
[javadoc] at com.sun.tools.javadoc.Main.execute(Main.java:59)
[javadoc] at com.sun.tools.javadoc.Main.main(Main.java:49)
[javadoc] com.sun.tools.doclets.internal.toolkit.util.DocletAbortException
[javadoc] at com.sun.tools.doclets.formats.html.HtmlDoclet.generateClassFiles(HtmlDoclet.java:190)
[javadoc] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.generateClassFiles(AbstractDoclet.java:183)
[javadoc] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:125)
[javadoc] at com.sun.tools.doclets.internal.toolkit.AbstractDoclet.start(AbstractDoclet.java:83)
[javadoc] at com.sun.tools.doclets.formats.html.HtmlDoclet.start(HtmlDoclet.java:63)
[javadoc] at com.sun.tools.doclets.standard.Standard.start(Standard.java:39)
[javadoc] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[javadoc] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[javadoc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[javadoc] at java.lang.reflect.Method.invoke(Method.java:601)
[javadoc] at com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.java:280)
[javadoc] at com.sun.tools.javadoc.DocletInvoker.start(DocletInvoker.java:160)
[javadoc] at com.sun.tools.javadoc.Start.parseAndExecute(Start.java:397)
[javadoc] at com.sun.tools.javadoc.Start.begin(Start.java:167)
[javadoc] at com.sun.tools.javadoc.Main.execute(Main.java:59)
[javadoc] at com.sun.tools.javadoc.Main.main(Main.java:49)
[javadoc] Generating C:\Users\James\workspace\docs\courseworkone\Entry.html...
BUILD SUCCESSFUL
Total time: 5 seconds
javadoc を適切に生成できない理由がわかりません
何か案は?