java - How to find root of "Could not find or load main class" error when running JAR -


i have seen question asked many times, there no precise answer problem. story simple - downloaded legitimate jar file, functioning , advertised application, here: https://github.com/kamilfb/mqtt-spy/wiki/downloads.

the application brings obvious instruction start java -jar mqtt-spy-0.2.0-jar-with-dependencies.jar results in known error, being in case error: not find or load main class pl.baczkowicz.mqttspy.main

my system ubuntu 15.04, java version 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 computer test elsewhere. did checks , jar file looks pretty normal. tried de-compressing , running class directly, won't budge, same error message. tried online .class analysis tools, nothing caught attention. reviewed dozen of pages referring "could not find or load" problem. no luck far.

not sure if bothers, did java programmers certification sun yet in 2005... , feel frustrated now. while hope there easy solution problem, e.g. nice ubuntu issue ;-), ready dig deeper, , looking hints guide me finding root cause of issue.

thank helpful me. had same problem, , looking the solution here well

my fix was:

sudo add-apt-repository ppa:webupd8team/java  sudo apt-get update 

then, install jdk oracle 8

sudo apt-get install oracle-java8-installer 

and then, checking java:

sudo update-alternatives --config java 

it displayed between other choices:

 0            /usr/lib/jvm/java-8-oracle/jre/bin/java          1082       auto mode ...... 

press keep current choice[*], or type selection number:

i keep 0 current choice [*]

then, running mqttspy worked fine :-)

java -jar mqtt-spy-0.5.1-jar-with-dependencies.jar 

Comments

Popular posts from this blog

dns - How To Use Custom Nameserver On Free Cloudflare? -

python - Pygame screen.blit not working -

c# - Web API response xml language -