I followed this "tutorial" to build a jar from a project in intellj. The project includes a small spring application, that works running from intellij itself.
If I build the jar and run it from the command line, it says "Error: Could not find or load main class". If I run the main.class file using java .\main.class
, the same Message shows up.
I specified the Main class in Intellij-IDEA before building the Jar, and the Main.java file looks something like this:
@SpringBootApplication
@RestController
public class Main {
public static void main(String[] args) {
SpringApplication.run(Main.class, args);
}
@GetMapping("/index")
public String index() {
. . . .
}
}