I have seen this question asked so many times, but there was no precise answer to my problem. My story is simple - I downloaded a legitimate JAR file, for a functioning and advertised application, from here: https://github.com/kamilfb/mqtt-spy/wiki/Downloads.
The application brings the obvious instruction to start it as java -jar mqtt-spy-0.2.0-jar-with-dependencies.jar but that results in the well known error, being in my case Error: Could not find or load main class pl.baczkowicz.mqttspy.Main
My system is Ubuntu 15.04, Java version is
openjdk version "1.8.0_45-internal"
OpenJDK Runtime Environment (build 1.8.0_45-internal-b14)
OpenJDK 64-Bit Server VM (build 25.45-b02, mixed mode)
I don't have another computer to test it elsewhere. I did some checks and the JAR file looks pretty much normal. I even tried de-compressing it and running the class directly, it won't budge, same error message. I tried some online .class analysis tools, nothing caught my attention. Also I reviewed about a dozen of pages referring to "Could not find or load" problem. No luck so far.
Not sure if anyone bothers, but I did my Java Programmers certification with Sun yet in 2005... and I feel frustrated now. While I hope there is an easy solution for my problem, e.g. some nice Ubuntu issue ;-), I am ready to dig deeper, and looking for any hints that would guide me to finding the root cause of this issue.
Additionally install Java FX, since this is required and worked for me (Ubuntu 16: package openfx):
apt install openjfx
See also this issue: https://github.com/kamilfb/mqtt-spy/issues/88
I currently successfully run it on openjdk version "1.8.0_121" here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With