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

intellij run configuration classpath
convert intellij run configuration to command line
intellij add classpath jar
intellij add resource folder to classpath
intellij classpath jar
intellij classpath gradle
intellij classpath maven
set classpath in intellij run configuration

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?

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

Add a properties file to IntelliJ's classpath, Select the module whose classpath should be used to run the application. Include IntelliJ IDEA will configure this setting depending on the properties set in the  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.

It appears that IntelliJ 11 has changed the method, and the checked answer no longer works for me. In case anyone else arrives here via a search engine, here's how I solved it in IntelliJ 11:

  1. Go to the Project Structure, click on Modules, and click on your Module
  2. Choose the "Dependencies" tab
  3. Click the "+" button on the right-hand side and select "Jars or directories..."
  4. Add the directory(ies) you want (note you can multi-select) and click OK
  5. In the dialog that comes up, select "classes" and NOT "jar directory"
  6. Make sure you're using that Module in your run target

Note that step 5 seems to be the key difference. If you select "jar directory" it will look exactly the same in the IDE but won't include the path at runtime. There appears to be no way to determine whether you've previously selected "classes" or "jar directory" after the fact.

Advanced configuration - Help, Hi, I am relatively new to IntelliJ migrating from Eclipse and I have a question regarding the setup of our project and how I can run applications  Open Settings Under project Settings, select "project settings (1)" On the left, select "modules" Select the desired module Select the "Sources" tab In the tree structure, find the directory you want to add. Then either add as a source or test source. ]]> then the jar file will contains my directory H. And that is not what I want.

You can try -Xbootclasspath/a:path option of java application launcher. By description it specifies "a colon-separated path of directires, JAR archives, and ZIP archives to append to the default bootstrap class path."

Howto add a directory to the classpath? – IDEs Support (IntelliJ , There you can select a Jar Directory to add. Then make sure the run profile is using the Classpath and JDK of the correct module when it runs (this is in the run​  I am relatively new to IntelliJ migrating from Eclipse and I have a question regarding the setup of our project and how I can run applications and unit tests. It is a rather legacy application and the structure is something like this main - dist -lib DEV -- All dev configuration UNIT-TESTS

I am using Idea 8. in your module dependancies tab (in the project structure dialog). Add a "Module Library". There you can select a Jar Directory to add. Then make sure the run profile is using the Classpath and JDK of the correct module when it runs (this is in the run config dialog.

Run/Debug Configuration: Application - Help, IntelliJ classpath? Adding Property files to Classpath. Last Updated on March 16th, 2020 by App Shah 6 comments Error: Could not find or load main class in intelliJ IDE; IntelliJ IDEA – getClass(). Today while running tutorial how to read config.properties file in Java at runtime I got below error in IntelliJ IDE. Program  JAR manifest: IntelliJ IDEA will pass a long classpath via a temporary classpath.jar. The original classpath is defined in the manifest file as a class-path attribute in classpath.jar . You will be able to preview the full command line if it was shortened using this method, not just the classpath of the temporary classpath.jar .

Set "VM options" like: "-cp $Classpath$;your_classpath"

Adding directory to classpath in Run/Debug , In this repository All Add the path to the IntelliJ IDEA bin folder to the Path exact question was "how to add directory to classpath in an application run profile". I am using IDEA 11 and need to run a class with a main method but with additional classpath entries - both xml files and jars. I have tried adding them as Global Libraries, as additional source content roots, and as regular additional libraries, however none of these seem to pick up the xml files and so when I execute the run config I get

how to add directory to classpath in an application run profile in , To add a directory to classpath in IntelliJ (extracted this snippet from to-add-​directory-to-classpath-in-an-application-run-profile-in-intellij-idea). IntelliJ should download and add all your dependencies to the project's classpath automatically as long as your POM is compliant and all the dependencies are available. When importing Maven projects into IntelliJ an information box usually comes up asking you if you want to configure Auto-Import for Maven projects.

How to add Resources Folder, Properties at Runtime into IntelliJ , Working with Profiles MagicDraw or other modeling tool as part of another application Extract <MagicDraw installation directory>\openapi\ide\intellij.zip to a project are ready for the source code development and running/debugging. It is mandatory to setup Intellij IDEA to create that classpath file for  The classpath of intellij is not the same as the classpath of your project/application. Make sure you added the library to the build path of your project! – Mark Rotteveel Jun 5 '15 at 8:59

Intellij add all to classpath, IntelliJ: How to add all jar files in a folder to classpath IntelliJ. But exact question was "how to add directory to classpath in an application run profile". class file. Compiling with javac using the output folder option. java file, IntelliJ IDEA will  To import jar file in your Eclipse IDE, just follow the steps provided below. Right-click on your project; Select Build Path; Click on Configure Build Path

Comments
  • It is not clear to me, where you are trying to add that. From the IJ command line? Or in the project properties?
  • Related: youtrack.jetbrains.net/issue/IDEA-160167
  • So how would you create to run configurations with two different directories that must be exclusively present in one but not the other. In eclipse you can add/remove anything to a launch configuration. Does IntelliJ not support this?
  • It's pretty clear that you can change classpath of run configuration changing module classpath. But exact question was "how to add directory to classpath in an application run profile". So the real was given by uaaquarius
  • Thank you ! This solved my problem after ages of searching around !
  • Step 6 does not come up for me. I am on intellij 14. I have a folder called lib where my .jar are located. selecting the folder or jar will just parse the path into intellij. still does not work
  • @Takeru Did you figure this out?
  • Thank you so much for posting this. You just saved me an hour or so.
  • I have the same problem as before with IJ11 and was happy to find an answer waiting for me this time.
  • Perfect. Same process for IJ12. Ran across this post when trying to resolve 'java.lang.ClassNotFoundException: com/microsoft/jdbc/sqlserver/SQLServerDriver' This resolved the connection issue. Thanks
  • I don't get step 5 :( The dialog just doesn't come up.
  • @CharlesWood: When I wanted to select two folders with one of them containing sub-folders. I had to expand the one containing sub-folders via the little arrow symbol next to the folder name in order for the dialog to show up. Otherwise, the dialog would be skipped.
  • Some documentation on how -Xbootclasspath works: docs.oracle.com/cd/E15289_01/doc.40/e15062/optionx.htm#i1018570