0

when I launch my .jar with this command "java -jar epsilon-1.0.jar" He says "Cannot find or load main class net.epsilon.app.Main"

plugins {
    id 'java'
}

group 'net.epsilon'
version '1.0'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

task fatJar(type: Jar) {
    manifest {
        attributes["Main-Class"] = "net.epsilon.app.Main"
    }
    destinationDir = file("C:/Users/EliXorZz/Desktop/EpsilonAPP")
    from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
    with jar
}

tasks.withType(JavaCompile) {
    options.encoding = 'UTF-8'
}

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.13'
    compile group: 'com.github.docker-java', name: 'docker-java', version: '3.2.0'
    compile group: 'redis.clients', name: 'jedis', version: '3.3.0'
    compile group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
    compile 'me.tongfei:progressbar:0.8.1'
}

My file architecture

Help me please. Thank you.

Sorry, I'm not english.

smac89
  • 39,374
  • 15
  • 132
  • 179

1 Answers1

1

No it can't work this way.

First, you are copying all the jars to a folder called C:/Users/EliXorZz/Desktop/EpsilonAPP, but when you run your jar, you never tell java to place those jars you copied into the classpath.

So actually the command to run your jar is:

java -jar epsilon-1.0.jar -classpath 'C:/Users/EliXorZz/Desktop/EpsilonAPP/*'
smac89
  • 39,374
  • 15
  • 132
  • 179