Reputation: 359
I have seen many people ask this question but none of the answers have solved my problem.
I have written a Java project in Intellij which runs fine in Intellij. I need it to run on the command line however.
Intellij automatically builds the .class files in the following directories which is outlined as follows:
C:\git\myProject\out\production\myProject\main
C:\git\myProject\out\production\myProject\openNlpTools
C:\git\myProject\out\production\myProject\sentimentAnalysisTools
I have three sub directories here. The file with the main method is in the \main folder.
To run the program I thought I used the following:
java main.FileMonitor
When I run this however I get the following error:
Error: Could not find or load main class main.FileMonitor
Does anyone have any tips as to why this isn't running? Intellij runs the program fine, is there anyway I can see the command IntelliJ uses to run the program?
Thanks!
Upvotes: 1
Views: 5125
Reputation: 533880
If you can't file a class it usually means you didn't include it in your class path. Some ways to run in the command line
Copy from IntelliJ
Using Maven/Gradle
Main-Class
in the assembly pluginassembly:single
Upvotes: 1