I know how to run and compile a basic Java program in the terminal using java
and javac
.
I also know how to run and compile a Java program using IntelliJ.
However, how do you run a program in an IntelliJ project using the terminal.
So far all my classes is compiled to a "out/production/myproject" folder by default in Intellij. So far I have tried the following command in the above folder:
java Main
However for some reason it says:
Error: Could not find or load main class Main
When you run a program in Intellij, in the run window (bottom panel) the very first line is what intellij terminal command. The line usually is shortened like this:
/Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk/Contents/Home/bin/java...
If you click on it, it will show you full command that Intellij runs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With