How to Add Directory to Classpath in an Application Run Profile in Intellij Idea

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

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

How to include directories in classpath of Intellij run configuration

Right click on the directory, which you want to add in the class path.

And then select option "mark directory as" with different options e.g. "Sources Route", "Resources Route" etc.

Apply the option as per the need.

Add a properties file to IntelliJ's classpath

Try this:

  • 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.


Related Topics



Leave a reply



Submit