Can someone tell me how run .jar file with Intellij and Gradle in cmd?
I try create manifest file but get errors:
no main manifest attribute, in eureka-server.jar
or
Error: Could not find or load main class com.project.EurekaServerApplication
Caused by: java.lang.ClassNotFoundException: com.project.EurekaServerApplication
My main class:
package com.project;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
@SpringBootApplication
@EnableEurekaServer
public class EurekaServerApplication {
public static void main(String[] args) {
SpringApplication.run(EurekaServerApplication.class, args);
}
}
In MANIFEST.MF in path /resources/META-INF
Manifest-Version: 1.0
Main-Class: com.project.EurekaServerApplication
Also I try it, in build.gradle
jar {
manifest {
attributes(
'Main-Class': 'com.project.EurekaServerApplication'
)
}
}
I run this jar file in this way:
java -jar [nameApplication].jar
SpringBoot
application you should run it withgradle bootRun
command not from a.jar
file – Ante Jablan Adamović