I have created a very basic gradle java project that prints "Hello Word". The main class builds and runs fine. When i try to run java -jar out\artifacts\helloWorld_jar\helloWorld.jar
on the command line it gives me this error
Error: Could not find or load main class com.exmple.helloWorld
Caused by: java.lang.ClassNotFoundException: com.exmple.helloWorld
here is how my directory looks
|-gradle
|-.idea
|-build
|-gradle
|-META-INF
|-out
| -artifacts
| -helloWorld_jar
| -helloWorld.jar
|-src
|-main
|-java
|- com.exmple
|-helloWorld
|-test
|build.gradle
etc...
My build.gradle file looks like this:
plugins {
id 'java'
}
group 'org.example'
version '1.0-SNAPSHOT'
repositories {
mavenCentral()
}
jar{
manifest{
attributes "Main-Class": "com.exmple.helloWorld"
}
}
dependencies {
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
}
test {
useJUnitPlatform()
}
I have tried both single quotes and double quotes and it still runs an error. Any ideas on how to fix this? I have been trying for a few days now.
PS. example is spelt wrong, but its spelt exmple throughout