dorkbox / SystemTray

Cross-platform SystemTray support for Swing/AWT, macOS, GtkStatusIcon, and AppIndicator on Java 8+
Other
430 stars 58 forks source link

Errors on Igel OS 11 #151

Closed St3pp3nw0lf82 closed 1 year ago

St3pp3nw0lf82 commented 3 years ago

Hi, I included the 4.1 release via Maven in my project, but it still does not work and gives some errors. In particular, the following errors are thrown on startup:

12:56:22.125 [main] DEBUG dorkbox.jna.linux.AppIndicator - Error loading GTK3 library name 'appindicator3'.
12:56:22.139 [main] DEBUG dorkbox.jna.linux.AppIndicator - Error loading GTK3 library name 'appindicator3-1'.
12:56:22.153 [main] DEBUG dorkbox.jna.linux.AppIndicator - Error loading GTK3 library name 'appindicator-gtk3'.
12:56:22.174 [main] DEBUG dorkbox.jna.linux.AppIndicator - Error loading GTK3 library name 'appindicator-gtk3-1'.

As soon as I click on the trayicon, it gives the following error:

Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: Unable to load library 'user32':

Here is the output if I launch the application in debug mode:

14:33:13.049 [main] DEBUG dorkbox.systemTray.SystemTray - OS: Linux
14:33:13.056 [main] DEBUG dorkbox.systemTray.SystemTray - Arch: amd64
14:33:13.057 [main] DEBUG dorkbox.systemTray.SystemTray - Oracle Corporation OpenJDK 64-Bit Server VM 1.8.0_262
14:33:13.057 [main] DEBUG dorkbox.systemTray.SystemTray - Is Auto sizing tray/menu? true
14:33:13.057 [main] DEBUG dorkbox.systemTray.SystemTray - Is JavaFX detected? false
14:33:13.057 [main] DEBUG dorkbox.systemTray.SystemTray - Is SWT detected? false
14:33:13.266 [main] DEBUG dorkbox.systemTray.SystemTray - Java Swing L&F: Metal
14:33:13.266 [main] DEBUG dorkbox.systemTray.SystemTray - Auto-detecting tray type
14:33:13.266 [main] DEBUG dorkbox.systemTray.SystemTray - Force GTK2: false
14:33:13.266 [main] DEBUG dorkbox.systemTray.SystemTray - Prefer GTK3: true
14:33:13.310 [main] DEBUG dorkbox.systemTray.SystemTray - Currently using the 'Unknown' desktop environment
DISTRIB_ID=IGEL
DISTRIB_RELEASE=V11
DISTRIB_CODENAME="IGEL OS 11"
DISTRIB_DESCRIPTION="IGEL OS 11 (64bit)"
HELP_URLS=""
NAME="IGEL OS 11"
VERSION="11.04.240"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="IGEL OS 11.04.240"
VERSION_ID="18.04"
HOME_URL="http://www.igel.com/"
SUPPORT_URL="https://support.igel.com"
BUG_REPORT_URL="https://www.igel.com/submit-a-ticket/"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
IGEL OS 11.04.240

14:33:13.662 [main] DEBUG dorkbox.jna.linux.GtkLoader - GTK: libgtk-3.so.0
14:33:13.664 [GTK Native Event Loop] DEBUG dorkbox.jna.linux.GtkEventDispatch - Running GTK Native Event Loop
14:33:13.768 [main] DEBUG dorkbox.systemTray.SystemTray - GTK Version: 3.22.30
14:33:13.768 [main] DEBUG dorkbox.systemTray.SystemTray - Is the system already running GTK? false

You mentioned that you got it working on Igel OS. Unfortunately, it doesn't work on mine yet. Have you installed any packages beforehand on Igel, like appindicator?

Hope you can help me out here. Looking forward to hearing back from you. Kind Regards

dorkbox commented 3 years ago

Currently using the 'Unknown' desktop environment is a problem... It should be detecting igel - i'll fix that for the next release - it should be soon, as I'm currently working on getting better JPMS support working.

dorkbox commented 3 years ago

Just some more thoughts...

Can you also copy/paste the tray example (from source), and run those as-is, and see what happens? There might be a configuration error in your code, and running from a known state might help track down what exactly is going on.

St3pp3nw0lf82 commented 3 years ago

Hi, thanks for getting back that fast. I followed your advice and built a very simple and slim maven java application that only includes junit (added by default from maven) and your library as dependencies and launches a trayicon on startup. Below are the contents of the projects pom.xml:

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>de.gisbo.igelapp</groupId>
  <artifactId>trayicon-app</artifactId>
  <version>1.0-SNAPSHOT</version>

  <name>trayicon-app</name>
  <!-- FIXME change it to the project's website -->
  <url>http://www.example.com</url>

  <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.7</maven.compiler.source>
        <maven.compiler.target>1.7</maven.compiler.target>
  </properties>

  <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.dorkbox/SystemTray -->
        <dependency>
            <groupId>com.dorkbox</groupId>
            <artifactId>SystemTray</artifactId>
            <version>4.1</version>
        </dependency>
  </dependencies>

  <build>
    <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
      <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>3.2.0</version>
            <configuration>
            <executable>true</executable>
            <archive>
                <manifest>
                    <mainClass>de.gisbo.igelapp.App</mainClass>
                    <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                </manifest>
            </archive>
            </configuration>
        </plugin>
        <!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
        <plugin>
          <artifactId>maven-clean-plugin</artifactId>
          <version>3.1.0</version>
        </plugin>
        <!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
        <plugin>
          <artifactId>maven-resources-plugin</artifactId>
          <version>3.0.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-compiler-plugin</artifactId>
          <version>3.8.0</version>
        </plugin>
        <plugin>
          <artifactId>maven-surefire-plugin</artifactId>
          <version>2.22.1</version>
        </plugin>
        <!-- <plugin>
          <artifactId>maven-jar-plugin</artifactId>
          <version>3.0.2</version>
        </plugin> -->
        <plugin>
          <artifactId>maven-install-plugin</artifactId>
          <version>2.5.2</version>
        </plugin>
        <plugin>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>2.8.2</version>
        </plugin>
        <!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
        <plugin>
          <artifactId>maven-site-plugin</artifactId>
          <version>3.7.1</version>
        </plugin>
        <plugin>
          <artifactId>maven-project-info-reports-plugin</artifactId>
          <version>3.0.0</version>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>
</project>

The main App class looks as follows:

package de.gisbo.igelapp;

import java.net.URL;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import dorkbox.systemTray.MenuItem;
import dorkbox.systemTray.SystemTray;

/**
 * Trayicon Test
 *
 */
public class App {
    private SystemTray systemTray;

    public App() {
        System.out.println( "Testing Systemtray..." );
        try {
            SystemTray.DEBUG = true;
            this.systemTray = SystemTray.get();
            if (this.systemTray == null) {
                throw new RuntimeException("Unable to load SystemTray!");
            }
            this.systemTray.setTooltip("GisboAlarm");
            this.systemTray.installShutdownHook();
            // Loading trayicon:
            URL imageUrl = App.class.getResource("images/trayicon_weiss.png");
            this.systemTray.setImage(imageUrl);
            // Add popup menu:
            MenuItem quitItem = new MenuItem("Quit", new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    App.this.systemTray.shutdown();
                    // Quit also App:
                    System.exit(0);
                }
            });
            systemTray.getMenu().add(quitItem).setShortcut('q');
        } catch (Exception exp) {
            System.out.println( "main(), error: " + exp.getMessage());
        }
    }
    public static void main( String[] args ) {
        new App();
    }
}

To launch the app on Igel, I then created a jar file with "mvn clean package". When I launch the jar file on Igel, I get the following error now:

user@ITC00E0C5241D89:/custom/gisboalarm$ sh trayicon.sh 
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: dorkbox/systemTray/Entry
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:650)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:632)
Caused by: java.lang.ClassNotFoundException: dorkbox.systemTray.Entry
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:419)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
... 7 more
user@ITC00E0C5241D89:/custom/gisboalarm$

I hope it helps to nail the reason of the error down.

St3pp3nw0lf82 commented 3 years ago

Hi,

could you provide me please with a rough guess when you think the Maven 4.2 release of the Systemtray will be available?

Thanks in advance.

Kind Regards,

Johannes Cox

Software Developer

dorkbox commented 3 years ago

I'm trying to get a proper JPMS release done by Friday. It's a bit of a mess trying to get all of the dependent libraries correctly setup for jpms.

dorkbox commented 3 years ago

I'm having trouble getting SWT working with JPMS -- i'll release 4.2 without fixes to JPMS - just so igel os is tested again and working.

dorkbox commented 3 years ago

can I send you test jars? I've got most of them built already, but there are SWT problems if you are loading them via the module-system, but they should work fine using the classpath.

St3pp3nw0lf82 commented 3 years ago

Hi, yes sure you can send me test jars.

You mentioned problems with SWT and loading them via classpath rather than the module system. How do I need to include your jar in my programm?

I remember fiddeling around myself with your systemtray library by cloning it into my own repo. To include it, I created a local repository in my maven application, installed your jar there and then included it via the pom.

But I remember that didn’t work very well, I struggled quite often with „No classdef found“ errors. Some of the dependencies were found in your Utilities package, so I tried to include that aswell separately. Not a fun time at all :)

So I’m really happy to try your jars but you need to tell me how I need to include it properly in my application.

Best Regards

Johannes Cox

Software Developer

dorkbox commented 3 years ago

libs.zip

See if these jars can get you started

St3pp3nw0lf82 commented 3 years ago

Hi, just a quick update.

To check your jars, I used my small project I created last time that just creates a trayicon. I deleted all artifacts from my local maven repo that belonged to group com.dorkbox and installed your new ones with the mvn install:install-file (https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html)

However, after launching the final jar on Igel, I get the exact same error again as last time:

Java.lang.NoClassDefError: dorkbox/systemTray/Entry

I attached also a screenshot of this.

Kind Regards from Zweibrücken

Johannes Cox

Software Developer

dorkbox commented 3 years ago

Just to make sure... can you use the Java 8 jvm?

On April 28, 2021 15:16:40 St3pp3nw0lf82 @.***> wrote:

Hi, just a quick update.

To check your jars, I used my small project I created last time that just creates a trayicon. I deleted all artifacts from my local maven repo that belonged to group com.dorkbox and installed your new ones with the mvn install:install-file (https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html)

However, after launching the final jar on Igel, I get the exact same error again as last time:

Java.lang.NoClassDefError: dorkbox/systemTray/Entry

I attached also a screenshot of this.

Kind Regards from Zweibrücken

Johannes Cox

Software Developer

https://gisbo.de/gisbo_logo_72.jpg

Gisbo Softwareentwicklung und EDV-Beratung GmbH Etzelweg 234 D - 66482 Zweibrücken

E-Mail: @.*** Web: www.gisbo.de https://www.gisbo.de/

Tel.: +49 (0) 6332 - 99 790 84 Fax: +49 (0) 6332 - 99 790 80


Geschäftsführung: Sabine Eßer und Stella Bayer Amtsgericht Zweibrücken HRB 1552Z, Steuernummer: 35/657/0427/7

https://www.youtube.com/watch?v=76OeqWr9kUY&feature=youtu.be https://www.facebook.com/gisbo https://www.instagram.com/gisboalarm/ https://twitter.com/GisboGmbh

Von: dorkbox @.> Gesendet: Mittwoch, 28. April 2021 10:00 An: dorkbox/SystemTray @.> Cc: St3pp3nw0lf82 @.>; Author @.> Betreff: Re: [dorkbox/SystemTray] Errors on Igel OS 11 (#151)

libs.zip https://github.com/dorkbox/SystemTray/files/6390072/libs.zip

See if these jars can get you started

You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dorkbox/SystemTray/issues/151#issuecomment-828239872 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AAN46JESZHS7HVRNILNFNJLTK 657ZANCNFSM42ZHL6OA .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

St3pp3nw0lf82 commented 3 years ago

Good Morning :)

I just ran java -XshowSettings:properties -version on both my Windows machine (my development environment) and on Igel in a terminal.

It prints on both machines for the vm version 1.8 which - according to Javas versioning rules - should be Java 8.

I also attached two screenshots of the above commands output showing the relevant section.

Cheers from Zweibrücken

Johannes Cox

Software Developer

https://gisbo.de/gisbo_logo_72.jpg

Gisbo Softwareentwicklung

und EDV-Beratung GmbH Etzelweg 234 D - 66482 Zweibrücken

dorkbox commented 3 years ago

Hm. I'm not sure what is causing that error. It seems like the jar is not getting loaded onto the classpath?

St3pp3nw0lf82 commented 3 years ago

Hi, thanks fort he feedback. I will have a look into that.

Cheers from Zweibrücken

Johannes Cox

Software Developer

https://gisbo.de/gisbo_logo_72.jpg

Gisbo Softwareentwicklung

und EDV-Beratung GmbH Etzelweg 234 D - 66482 Zweibrücken

St3pp3nw0lf82 commented 3 years ago

Hi, in order to deploy your jars with maven to a local repository, I need to provide the relevant command with a version number, like for example the 5.8.0 of your jna-jpms-5.8.0.jar.

Not all of your provided jars though have a version number in their name, like the kotlin libraries. The fact that I can not omit the version number in the deployment process, made me add a „1.0“ version number to the kotlin libs. Maven then includes the given version number in the final name of the deployed jar, so I ended up having a „kotlin-stdlib-1.0.jar“ file in my local repo. And that of course is different to the original file name.

This might be a reason for the NoClassDef found error I’m still getting.

So to erase that possible reason for the error, my question is:

Could you please provide me with versioned kotlin jars?

Kind Regards from Zweibrücken

Johannes Cox

Software Developer

https://gisbo.de/gisbo_logo_72.jpg

Gisbo Softwareentwicklung

und EDV-Beratung GmbH Etzelweg 234 D - 66482 Zweibrücken

St3pp3nw0lf82 commented 3 years ago

Hi again,

I managed to solve the issue with the NoClassDefFound error for the dorkbox/systemtray/Entry class. To build the final jar that also includes all defined dependencies, I had to use the maven shade plugin in addition which makes sure that all defined dependencies in my pom.xml are also present in the final uber jar.

The result is a shaded fat jar and if I execute that, the previous problem is gone.

But now, I have the same problem with another class. I get the same for: Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/spi/LoggingEventBuilder

I also attached a screenshot showing the error.

Could that be „really“ the case here?

Kind Regards from Zweibrücken

Johannes Cox

Software Developer

St3pp3nw0lf82 commented 3 years ago

Hi again,

I just checked the contents of the jar by myself and indeed, there is no class „LoggingEventBuilder“ in org/slf4j/spi.

So this error is justified :)

Freundliche Grüße aus Zweibrücken

Johannes Cox

Software Developer

https://gisbo.de/gisbo_logo_72.jpg

Gisbo Softwareentwicklung

und EDV-Beratung GmbH Etzelweg 234 D - 66482 Zweibrücken

St3pp3nw0lf82 commented 3 years ago

Hi, and another update fromm y side: I replaced the slf4j-api version that you sent me (slf4j-api-1.8.0.beta4) with the slf4j-api-1.7.30.jar and I got it running on my Windows machine. Trayicon appears :)

However, if I copy the final jar over to the Igel and execute it there, I get another different error. Again, NoClassDefFoundError, but this time for: javassist/bytecode/BadBytecode

Freundliche Grüße aus Zweibrücken

Johannes Cox

Software Developer

https://gisbo.de/gisbo_logo_72.jpg

Gisbo Softwareentwicklung

und EDV-Beratung GmbH Etzelweg 234 D - 66482 Zweibrücken

St3pp3nw0lf82 commented 3 years ago

This is my final message, sorry for sending you that many emails, but I think it is also important for you that I keep you posted about the steps I took that got me finally here.

So, I installed javassist from the Maven repo as a dependency in my project and the error message from my last post went away and I finally could launch the app on IgelOS.

The bad news is that it still does not run as it should. The trayicon itself looks weired and as soon as I click on it, an error is thrown.

Again, I attached screenshots to this mail for clearance. One that shows the look oft he trayicon and the other one showing the error message itself.

Freundliche Grüße aus Zweibrücken

Johannes Cox

Software Developer

https://gisbo.de/gisbo_logo_72.jpg

Gisbo Softwareentwicklung

und EDV-Beratung GmbH Etzelweg 234 D - 66482 Zweibrücken

E-Mail: @.*** Web: www.gisbo.de https://www.gisbo.de/

Tel.: +49 (0) 6332 - 99 790 84

Fax: +49 (0) 6332 - 99 790 80


Geschäftsführung: Sabine Eßer und Stella Bayer Amtsgericht Zweibrücken HRB 1552Z, Steuernummer: 35/657/0427/7

https://www.youtube.com/watch?v=76OeqWr9kUY&feature=youtu.be https://www.facebook.com/gisbo https://www.instagram.com/gisboalarm/ https://twitter.com/GisboGmbh

Von: dorkbox @.> Gesendet: Freitag, 30. April 2021 13:39 An: dorkbox/SystemTray @.> Cc: St3pp3nw0lf82 @.>; Author @.> Betreff: Re: [dorkbox/SystemTray] Errors on Igel OS 11 (#151)

Hm. I'm not sure what is causing that error. It seems like the jar is not getting loaded onto the classpath?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dorkbox/SystemTray/issues/151#issuecomment-830034948 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AAN46JECE63UEOTK56E65H3TLKJGVANCNFSM42ZHL6OA .

dorkbox commented 3 years ago

Oh interesting.

Thank you for the info/emails! The more info I have on how problems are fixed, the better equipped I am to fix them.