What I am trying to do is make a jar file and run it. I have a maven project whose pom.xml looks like this
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>test</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>hola.test</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-hive_2.11</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20160810</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.3</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>transport</artifactId>
<version>5.5.0</version>
</dependency>
</dependencies>
</project>
and my manifest
Manifest-Version: 1.0
Main-Class: hola.test
I have my jar file under projectroot/out/artifacts/test_jar/test.jar
and my manifest under projectroot/main/resources/meta-inf/manifest.mf
As stated my some questions like this one. I created out folder myself then built my artifact, but no help.I don't remember facing this problem while working with Netbeans. Is this Intelij bug or something? or am I missing some points ? This is the error output
/usr/lib/jvm/java-1.8.0-openjdk-i386/bin/java -Dfile.encoding=UTF-8 -jar /home/saurab/sparkProjects/test/out/artifacts/test_jar/test.jar
Error: Could not find or load main class hola.test
Steps I took to create jar file 1) go to project structure 2) artifact > hit[+] > jar > from modules with dependencies >select main class[in my case is test] & change manifest folder from main/java to main/resources > hit[OK] > hit [OK]