如何在 IntelliJ IDEA 的应用程序运行配置文件中将目录添加到类路径? [英] How to add directory to classpath in an application run profile in IntelliJ IDEA?

查看:50
本文介绍了如何在 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. 单击项目"视图或通过单击窗口左边框上的1:项目"按钮或按 Alt + 1 取消隐藏它
  2. 找到您的项目或子模块并单击它以突出显示它,然后按 F4,或右键单击并选择打开模块设置"(在 IntelliJ 14 上它变成了 F12)
  3. 点击依赖项标签
  4. 点击右侧的+"按钮,然后选择罐子或目录..."
  5. 找到您的路径并点击确定
  6. 在Choose Categories of Selected File"对话框中,选择Classes(即使是属性),再次点击OK和OK
  7. 您现在可以运行您的应用程序,它将在类路径中具有所选路径
  1. 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
  2. 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)
  3. click on the dependencies tab
  4. Click the "+" button on the right and select "Jars or directories..."
  5. Find your path and click OK
  6. In the dialog with "Choose Categories of Selected File", choose Classes (even if it's properties), press OK and OK again
  7. You can now run your application and it will have the selected path in the class path

这篇关于如何在 IntelliJ IDEA 的应用程序运行配置文件中将目录添加到类路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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