如何在IntelliJ IDEA中的应用程序运行配置文件中将目录添加到类路径? [英] How to add directory to classpath in an application run profile in IntelliJ IDEA?
本文介绍了如何在IntelliJ IDEA中的应用程序运行配置文件中将目录添加到类路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将目录添加到应用程序运行配置文件的类路径中
I'm trying to add a directory to the classpath of an application run profile
如果我在VM设置中使用-cp x:target / classes覆盖,我收到以下错误:
If I override by using -cp x:target/classes in the VM settings, I get the following error:
java.lang.NoClassDefFoundError: com/intellij/rt/execution/application/AppMain
如何将目录添加到项目的类路径中?
Any idea on how to add a directory to the classpath for my project?
推荐答案
在Intellij 13中,它看起来又略有不同。以下是Intellij 13的说明:
In Intellij 13, it looks it's slightly different again. Here are the instructions for Intellij 13:
- 点击项目视图或通过单击1:项目按钮取消隐藏它左侧窗口边框或按Alt + 1
- 找到您的项目或子模块并单击它以突出显示它,然后按F4,或右键单击并选择打开模块设置 (在IntelliJ 14上它变为F12)
- 点击依赖项选项卡
- 点击右侧的+按钮,选择Jars or目录...
- 查找路径并单击确定
- 在选择所选文件的类别对话框中,选择
Classes
(即使它是属性),按OK并再次确定 - 您现在可以运行您的应用程序,它将在类路径中具有所选路径
- click on the Project view or unhide it by clicking on the "1: Project" button on the left border of the window or by pressing Alt + 1
- find your project or sub-module and click on it to highlight it, then press F4, or right click and choose "Open Module Settings" (on IntelliJ 14 it became F12)
- click on the dependencies tab
- Click the "+" button on the right and select "Jars or directories..."
- Find your path and click OK
- In the dialog with "Choose Categories of Selected File", choose
Classes
(even if it's properties), press OK and OK again - You can now run your application and it will have the selected path in the class path
这篇关于如何在IntelliJ IDEA中的应用程序运行配置文件中将目录添加到类路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文