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

Hi,

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.

Compilation
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

    Correction
root@tango9-deb:/home/blanchet/tango-install/hdbpp-viewer# mvn package
[INFO] Scanning for projects…
[WARNING] 
[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] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO]                                                                         
[INFO] ————————————————————————
[INFO] Building jhdbviewer 1.14-SNAPSHOT
[INFO] ————————————————————————
[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] 
[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] 
[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] 
[INFO] — maven-compiler-plugin:3.2:testCompile (default-testCompile) @ jhdbviewer —
[INFO] No sources to compile
[INFO] 
[INFO] — maven-surefire-plugin:2.17:test (default-test) @ jhdbviewer —
[INFO] No tests to run.
[INFO] 
[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] BUILD SUCCESS
[INFO] ————————————————————————
[INFO] Total time: 2.454 s
[INFO] Finished at: 2018-07-12T16:03:55+02:00
[INFO] Final Memory: 30M/276M
[INFO] ————————————————————————
root@tango9-deb:/home/blanchet/tango-install/hdbpp-viewer# 


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.

Regards,

Sebastien
Sebastien
Edited 6 years ago
Hi Sébastien,

Did you look at the link to the documentation provided in the README?
http://www.esrf.eu/computing/cs/tango/tango_doc/hdb_viewer/index.html

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

Hoping this helps
Reynald
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.
HDBVIEWER=$TANGO_JAVA_APPLIS/jhbdviewer.jar


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.

Regards

Sebastien
Sebastien
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.
Sebastien
Edited 6 years ago
 
Register or login to create to post a reply.