将属性文件添加到IntelliJ的类路径 [英] Add a properties file to IntelliJ's classpath

查看:246
本文介绍了将属性文件添加到IntelliJ的类路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Run-> Run菜单从IntelliJ IDE运行一个简单的Java程序。它工作正常。现在我想添加log4j日志记录。

I'm running a simple Java program from the IntelliJ IDE using the Run->Run menu. It works fine. Now I want to add log4j logging.

我在项目根目录下添加了一个resources文件夹。
我在该文件夹中添加了一个log4j.properties文件。
我更改了代码以记录某些东西。

I added a resources folder under my project root. I added a log4j.properties file in that folder. I changed the code to log something.

告诉IntelliJ在类路径中包含resources文件夹以便看到属性文件的正确方法是什么?

What is the right way to tell IntelliJ to include the resources folder in the classpath so the properties file is seen?

使用IntelliJ 8,我可以猜到像喝醉了的猴子一样,最终让它发挥作用。我现在有9个,而且我完全不成功。我已经尝试了一个小时。在某处添加到类路径选项怎么样? / fume / vent / rant

With IntelliJ 8 I could guess like a drunk monkey and eventually get it to work. I have 9 now and I am wholly unsuccessful. I've been trying for an hour. How about an "Add to classpath" option somewhere? /fume /vent /rant

推荐答案

试试这个:


  • 转到项目结构。

  • 选择您的模块。

  • 找到右侧树中的文件夹并选择它。

  • 单击该树上方的Sources按钮(使用蓝色文件夹),使该文件夹成为sources文件夹。

  • Go to Project Structure.
  • Select your module.
  • Find the folder in the tree on the right and select it.
  • Click the Sources button above that tree (with the blue folder) to make that folder a sources folder.

这篇关于将属性文件添加到IntelliJ的类路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆