gpt4 book ai didi

java - 如何在Netbeans中设置路径?

转载 作者:行者123 更新时间:2023-12-01 14:02:29 24 4
gpt4 key购买 nike

有人可以告诉我在 Netbeans 中的位置以及如何设置 path 吗?我想添加一个 .properties 文件

我有 log4j 示例项目,但看不到 log4j.properties 文件:

log4j:WARN No appenders could be found for logger (log4j_lesson.log4jExample).
log4j:WARN Please initialize the log4j system properly.

主类:

import org.apache.log4j.Logger;

import java.io.*;
import java.sql.SQLException;
import java.util.*;

public class log4jExample{
/* Get actual class name to be printed on */
static Logger log = Logger.getLogger(
log4jExample.class.getName());

public static void main(String[] args)
throws IOException,SQLException{

log.debug("Hello this is an debug message");
log.info("Hello this is an info message");
}
}

最佳答案

-Djava.library.path=/path/to/properties/file 添加到“VM 选项”中,右键单击该项目,然后选择“属性”即可在 Netbeans 中访问该选项“运行”。

或者将属性文件添加到项目的基本目录中,log4j 会自动查找它们。

关于java - 如何在Netbeans中设置路径?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19245610/

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