Gradle Scala Jar Not running Ubuntu

We are trying to run a gradle spark jar on Ubuntu which was built on Mac.The jar runs fine on Mac but in Ubuntu it gives “Cannot load or find Main class.Kindly help resolving the issue”.

Is there anything specific to be mentioned in build.gradle file or its JDK path issue, please suggest


    compileOnly group: "org.apache.spark", name: "spark-mllib_${scala_version}", version: "${spark_version}"
task fatJar(type: Jar) {
    duplicatesStrategy = DuplicatesStrategy.EXCLUDE
    zip64 true
    manifest {
        attributes 'Main-Class': ""
    archiveBaseName = "HelloWorld"
    from { configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) } }
    with jar