IntelliJ: How to use a main class which is not inside my Project Folder

470 Views Asked by At

I want to run a Project in IntelliJ, with a main class which is not inside my project folder. When I click the three dots to the right of the input, I can find this class (outside my project folder). However, once I run the project I get an error:

enter image description here

Error: Could not find or load main class org.vertx.java.platform.impl.cli.Starter

What I understand is that IntelliJ is looking for the main class INSIDE the project folder, and therefore, it can't find it.

My question is how to make IntelliJ activate a main class outside the project folder.

Edit: I also tried to add this external jar to Project Structure:enter image description here and it still didn't help.

1

There are 1 best solutions below

2
On

Add vertx-platform as a dependency to your module (in your pom.xml), then run it and select your module as the classpath.

enter image description here