在我的班级中使用{@link classname}作为外部API

时间:2011-03-28 10:44:56

标签: java classpath javadoc

我有以下内容:

package test.tester;

import org.apache.log4j.Logger;

public class tester {
    private static Logger logger = Logger.getLogger(tester.class);

    /**
     * {@link org.apache.log4j.Logger}
     * 
     * @param args
     */
    public static void main(final String[] args) {
        logger.info("test");
    }
}

这是成功生成Logger类的链接,但javadoc工具抱怨如下:

Constructing Javadoc information...
tester.java:3: package org.apache.log4j does not exist
import org.apache.log4j.Logger;
                      ^

tester.java:6: cannot find symbol
symbol  : class Logger
location: class test.tester.tester
private static Logger logger = Logger.getLogger(tester.class);
                    ^

1 个答案:

答案 0 :(得分:1)

我相信你应该在运行它时将log4j库添加到Javadoc类路径中。否则它无法知道它是什么。