I know that there are a lot of posts on SOF regarding this same topic , but I feel my problem is a little different.
I have a maven based java project which uses javaFx . Need to create an executable jar file and run it from the command line or on double click of the jar file.
This is how I build it , the relevant portion of my pom.xml file is this
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.sumanta.MyMain</mainClass>
</manifest>
<manifestEntries>
<Class-Path>./</Class-Path>
</manifestEntries>
</archive>
</configuration>
</plugin>
I then use maven to build the executable jar using this
clean compile assembly:single
I am using eclipse IDE .
The jar file that is created runs on windows 8 on double click and from the command line.
Now I need this to run on ubuntu linux as well . I have Open JDK 8 installed my linux installation but when I double click on the jar file nothing happens.
Then I open up the terminal and give this command
java -jar myExecutableJarFile.jar
I am getting this error
Error: Could not find or load main class com.sumanta.MyMain
It seems to be a problem with the manifest file . This file lists the proper name along with the full package path of the class which contains the main method
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Built-By: Ayan
Build-Jdk: 1.8.0_71
Main-Class: com.sumanta.MyMain
Class-Path: ./
What is wrong with this setup . I need the application to run on windows , linux , and mac OS. I suppose since mac and linux are unix type Os , if the application runs on linux it will run on mac os as well .