0

I've built jar with Maven.

On Windows it runs perfectly, shows window interface and works as needed by double click or from terminal. On Ubuntu server it throws an error: Could not find or load main class ***, meanwhile in jar this class exists at the needed place so probably there is loading error. Command: java -jar calibrator.jar from the same directory. Other module jars from the same project run normally.

Windows use JDK 1.8.0-161, Ubuntu - OpenJDK 64 9-internal.

What can be a reason to not work in Ubuntu?

A.Sergey
  • 1
  • 2
  • Please show us the structure of your jar as well as how you call it (and the manifest file if you have one). Also please verify the class _really_ exists in the jar and the spelling is correct - don't just assume it is correct, I can't tell how many times the error was in a part I was sure was correct. :) – Thomas Feb 12 '19 at 13:35
  • Do you have your manifest set up? Check this https://stackoverflow.com/questions/54574832/maven-executable-file-from-a-java-project/54575617#54575617 – Norbert Bicsi Feb 12 '19 at 13:40

2 Answers2

0

"Could not find or load main class " - Many times this problem caused by environment variables missing. Have you tried to set the environment Java variable on Ubuntu ?

How to set Java environment path in Ubuntu

(I cannot comment yet so I write it as answer...)

Good Luck

lingar
  • 477
  • 1
  • 7
  • 25
0

Problem was in javafx. This library was not included in openjdk8 and has it's own package. So my main class which was extending javafx.Application couldn't find parent class and load it. Installation openjfx package solves the issue.

A.Sergey
  • 1
  • 2