Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add directory to classpath in an application run profile in IntelliJ IDEA?

I'm trying to add a directory to the classpath of an application run profile

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?

like image 781
sal Avatar asked May 12 '09 18:05

sal


People also ask

How do I set classpath variables in IntelliJ?

In IntelliJ, Eclipse classpath variables are called path variables and they are accessible via this link: File > Settings > Appearance & Behaviour > Path Variables.


1 Answers

In Intellij 13, it looks it's slightly different again. Here are the instructions for Intellij 13:

  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
like image 159
stivlo Avatar answered Sep 18 '22 16:09

stivlo