Skip to content
Advertisement

Gradle – Could not find load main class

I need to tune the JVM memory by help of Gradle. I’ve writen settings in the gradle.properties file:

org.gradle.jvmargs=-XX:MaxMetaspaceSize=60M

but it didn’t work. Then I’ve done it manually in an IDEA (Run>Edit Configurations…) and wrote the settings for the needed class (in VM options: field) and it works. Can we do the same by help of Gradle?

I’ve tried to do:

org.gradle.jvmargs=-XX:MaxMetaspaceSize=60M test1.Test

but I got the error:

Error: Could not find or load main class test1.Test

Advertisement

Answer

When you run your application via IDEa, it runs the application using java ... command and gradle is not involed at all, so whatever you put in build.gradle doesn’t matter.

If you want to run your app via gradle, consider using application plugin, which allows you to set jvm args. If you use Spring Boot use can use bootRun task and specify params in jvmArgs property.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement