Home  >  Article  >  Java  >  How to Add Directories to the Classpath in IntelliJ IDEA Application Run Profiles?

How to Add Directories to the Classpath in IntelliJ IDEA Application Run Profiles?

Linda Hamilton
Linda HamiltonOriginal
2024-11-05 07:02:02906browse

How to Add Directories to the Classpath in IntelliJ IDEA Application Run Profiles?

Adding Directories to Classpath in IntelliJ IDEA Application Run Profiles

Adding directories to the classpath in IntelliJ IDEA application run profiles can be crucial for accessing external libraries or resources. When using the -cp option in VM settings, you may encounter an error related to NoClassDefFoundError for com/intellij/rt/execution/application/AppMain.

To add a directory to the classpath in Intellij 13:

  1. Open the Project view (press Alt 1).
  2. Select your project or sub-module, right-click, and choose "Open Module Settings" (or press F12 in IntelliJ 14).
  3. Navigate to the Dependencies tab.
  4. Click the " " button and select "Jars or directories..."
  5. Browse and select the desired directory.
  6. In the "Choose Categories of Selected File" dialog, choose Classes and press OK.
  7. Click OK again to save the changes.

Your selected directory will now be included in the classpath when you run the application from the run profile. This allows you to access classes and resources located within that directory.

The above is the detailed content of How to Add Directories to the Classpath in IntelliJ IDEA Application Run Profiles?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn