[SOLVED] [hdbpp-viewer] Error: Could not find or load main class HDBViewer.MainPanel


I am trying to compile and run hdbpp-viewer on Debian 9.

The release jhdbviewer-1.13 (4408e93) does not compile, so I have tried the latest revision ( 70d61cc). It compiles without errors, but I cannot run the program.

root@tango9-deb:/home/blanchet/tango-install/hdbpp-viewer# git log -1
commit 70d61cc38d0e844b196fecdb92db65fdf22f222f
Author: PONS <pons@esrf.fr>
Date:   Fri Nov 17 15:04:35 2017 +0100

root@tango9-deb:/home/blanchet/tango-install/hdbpp-viewer# mvn package
[INFO] Scanning for projects…
[WARNING] Some problems were encountered while building the effective model for org.tango:jhdbviewer:jar:1.14-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 62, column 21
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[INFO] ————————————————————————
[INFO] Building jhdbviewer 1.14-SNAPSHOT
[INFO] ————————————————————————
[INFO] — maven-resources-plugin:2.6:resources (default-resources) @ jhdbviewer —
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 10 resources
[INFO] — maven-compiler-plugin:3.2:compile (default-compile) @ jhdbviewer —
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 26 source files to /home/blanchet/tango-install/hdbpp-viewer/target/classes
[INFO] /home/blanchet/tango-install/hdbpp-viewer/src/main/java/HDBViewer/ChartPanel.java: Some input files use unchecked or unsafe operations.
[INFO] /home/blanchet/tango-install/hdbpp-viewer/src/main/java/HDBViewer/ChartPanel.java: Recompile with -Xlint:unchecked for details.
[INFO] — maven-resources-plugin:2.6:testResources (default-testResources) @ jhdbviewer —
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/blanchet/tango-install/hdbpp-viewer/src/test/resources
[INFO] — maven-compiler-plugin:3.2:testCompile (default-testCompile) @ jhdbviewer —
[INFO] No sources to compile
[INFO] — maven-surefire-plugin:2.17:test (default-test) @ jhdbviewer —
[INFO] No tests to run.
[INFO] — maven-jar-plugin:3.0.2:jar (default-jar) @ jhdbviewer —
[INFO] Building jar: /home/blanchet/tango-install/hdbpp-viewer/target/jhdbviewer-1.14-SNAPSHOT.jar
[INFO] ————————————————————————
[INFO] ————————————————————————
[INFO] Total time: 2.454 s
[INFO] Finished at: 2018-07-12T16:03:55+02:00
[INFO] Final Memory: 30M/276M
[INFO] ————————————————————————

Now I try to run the program, but it cannot find the main class
root@tango9-deb:/home/blanchet/tango-install/hdbpp-viewer# java -jar target/jhdbviewer-1.14-SNAPSHOT.jar 
Error: Could not find or load main class HDBViewer.MainPanel

Nevertheless, I have uncompressed jhdbviewer-1.14-SNAPSHOT.jar with unzip, and I found that the HDBViewr.MainPanel class is present.

I am a newbie in Java, so it would be nice if a seasoned Java developer could give me a hint.


Edited 2 years ago
Hi Sébastien,

Did you look at the link to the documentation provided in the README?

You need to have a correct CLASSPATH and you can follow the instructions from the "Command line" section of the documentation.

Hoping this helps
Rosenberg's Law: Software is easy to make, except when you want it to do something new.
Corollary: The only software that's worth making is software that does something new.
Hi Reynald,

I have tested the instructions in http://www.esrf.eu/computing/cs/tango/tango_doc/hdb_viewer/index.html

I have found a typo in the CLASSPATH.
A d letter is missing when defining HDBVIEWER variable.

After fixing it, I can run hdbpp-viewer. Then I have tried to modify CLASSPATH in this example, to see what happens.
If I remove important package like HDB++.jar, ATKCore.jar or ATKWidget.jar, I can reproduce the error that I had.

Now I understand that my issue is related to the CLASSPATH variable and that I have misunderstood the error message from java.
Java can find the class but it cannot load it because some dependencies are missing.

Thank for the tip, now I can continue my investigations.


I have found that was wrong: hdbpp-viewer needs the Java HDB++ Extraction Library.

It needs also jcalendar.jar and jython.jar, but I think that I can found a way to use the Debian version instead of the ESRF jar files.

Many thanks for the tip, now I can run hdbpp-viewer.
Edited 2 years ago
Register or login to create to post a reply.