gpt4 book ai didi

javadoc:如何使用它在 Window 7 上记录一个 java 文件?

转载 作者:搜寻专家 更新时间:2023-11-01 03:13:54 27 4
gpt4 key购买 nike

我正在尝试使用 javadoc 在窗口 7 上记录一个 java 文件,为了简化事情,我只使用以下简单命令:

javadoc Attr.java

然而,javadoc 给我IllegalArgumentException 并没有详细说明哪里错了,实际上,我使用的文件是从The Java Programming 复制的。所以,我想知道在窗口环境中使用“javadoc”命令需要什么。

一开始它似乎在工作......

Loading source file Attr.java...
Constructing Javadoc information...
Standard Doclet version 1.6.0_20
Building tree for all the packages and classes...
Generating Attr.html...

但随后它开始抛出这样的错误:

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:1003)
at java.lang.ClassLoader.getResourceAsStream(ClassLoader.java:1193)
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)

这是我使用的java测试文件:

/**
* An <code>Attr</code> object defines an attribute as a
* name/value pair, where the name is a <code>String</code>
* and the value an arbitrary <code>Object</code>.
*
* @version 1.1
* @author Plato
* @since 1.0
*/
public class Attr {
/** The attribute name. */
private final String name;
/** The attribute value. */
private Object value = null;

/**
* Creates a new attribute with the given name and an
* initial value of <code>null</code>.
* @see Attr#Attr(String,Object)
*/
public Attr(String name) {
this.name = name;
}

/**
* Creates a new attribute with the given name and
* initial value.
* @see Attr#Attr(String)
*/
public Attr(String name, Object value) {
this.name = name;
this.value = value;
}

/** Returns this attribute's name. */
public String getName() {
return name;
}

/** Returns this attribute's value. */
public Object getValue() {
return value;
}

/**
* Sets the value of this attribute. Changes the
* value returned by calls to {@link #getValue}.
* @param newValue The new value for the attribute.
* @return The original value.
* @see #getValue()
*/
public Object setValue(Object newValue) {
Object oldVal = value;
value = newValue;
return oldVal;
}

/**
* Returns a string of the form <code>name=value</code>.
*/
public String toString() {
return name + "='" + value + "'";
}
}

/=====解决方案 - 感谢 Michael Borgwardt=========/

第一期:

set CLASSPATH=. 

然后

javadoc Attr.java

最佳答案

嗯...考虑到错误发生在 URLClassLoader 调用的 ParseUtil 中:您是否有一个 CLASSPATH 环境内容格式错误的变量集?试试这个:

javadoc -classpath . Attr.java

关于javadoc:如何使用它在 Window 7 上记录一个 java 文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4115205/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com