简体   繁体   中英

Executing gradle exe from different location throws "Error: Could not find or load main class"

I am new to gradle, I have cloned a project from Github and as mentioned in their QuickGuide I ran ./gradlew build command to build the Gradle exe.So now I navigate to the folder where the exe is created inside the project and execute it via the command ./exe_name param1 param2 . When I have moved the exe to a different location and try to execute the same command , it throws the error Error: Could not find or load main class . How to resolve this issue ? Like in a fat jar we can mention the main class name inside the jar while execution Thanks

I'm not really sure, whether your project uses application plugin (or may be spring-boot plugin) or not, but if yes, then you have a root project folder with bin and lib directories within.

exe file is located in the bin directory and points to the jar -libraries within lib dir, so if you move it somewhere else, you have to move lib directory too, since it contains you project jar and all it's dependencies/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM