Reputation:
Here is my directory structure
Here is my build.gradle file
When I try to run the Gradle command ... grade run --info
I'm getting the following error
Please help.
Upvotes: 1
Views: 577
Reputation: 3830
The location of the compiled class:
build/classes/java/main/SampleFile.class
does not match the location of the java file:
src/in/swapnilsingh/SampleFile.java
The in/swapnilsingh
package directories are missing.
You are probably missing the package declaration at the top of the java file:
package in.swapnilsingh;
public class SampleFile {
// ...
}
Without the package declaration, the compiler will output the class file to the root of the output directory, the default package.
You can either add the package to the top of the SampleFile.java
file or remove the package prefix from the mainClassName
in the build.gradle
:
mainClassName = 'SampleFile'
Upvotes: 0