-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SystemTray 4.2 won't load on Windows 10 #184
Comments
Are you excluding dependencies? |
To be honest, I'm not sure. I'm doing whatever the build did for version 3.17. I know just enough about Gradle to generally feel stupid and this build was setup by another developer who's no longer around :) Here are the Gradle dependencies: https://github.com/Ortus-Solutions/runwar/blob/systemtray-4.2/dependencies.gradle |
If you want to inspect the jar produced by my build, you can see it here. The system tray lib is being "shaded" into an uber-jar along with other libraries. Let me know if anything in particular is missing. One thing that I'm a little unsure of is I have some direct dependencies on JNA and I see the latest SystemTray lib now has a jna folder. |
I've uploaded an example of using the system tray + gradle: https://git.dorkbox.com/dorkbox/SystemTray_Test |
Additionally, if you clone the system tray git repo, you can run the "jarExample" task, and it will create a fatjar of all dependencies + the example code (which is easy enough to just remove from the jar file) |
I can think of a few other things:
|
@dorkbox Thanks for the ideas on reducing jar size. Do you have any help on the error though
While the Gradle examples are cool, I generally would rather gouge my eyes out with dull spoons than make major changes to this Gradle build. Every time I've needed to do anything to it, 3 unrelated things break downstream. It's enough to drive me to violence :) If there's a specific dependency I'm missing or excluding, let me know. The main part my build that uses SystemTray (and worked for years with the 3.x versions) is
So unless the logback stuff is now a requirement in 4.x, I'll need some help understanding the error. |
Just to respond categorically to a few of your size related points (I'm not sure why you merged that discussion here since it really was unrelated entirely to the error on this ticket!)
I need all of them :) This project is bundled in a CLI tool that supports all OSs (windows, linux and friends, Mac) all architectures (intel, ARM, etc). all versions of java back to 8 and needs to be to a point where it can be dropped in and "just work". I don't have the liberty of knowing where on God's green earth my users will install my tool, from Alpine docker images to Raspberry Pis.
Yeah, sounds about right, but that ship is sort of sailed and I'm married to Log4j for now. My tool is used to start java servlets with JBoss Undertow primarily for running any of dozens of versions of Adobe ColdFusion or Lucee Server (A JVM Scripting language/application platform), each of which are a massive collection of Apache Commons libraries, and more OSGI bundles than you can shake a stick at. I'm capture log messages from libs using Log4j, SLF4J, JBoss Logging, you name it. Right now, Log4j is the tool we gather all those into to deal with and that's not changing any time soon.
I still need to support Java 8.
Oh, wouldn't it be nice to live in a world where I had the liberty of choosing that JVM my users had installed, lol. The upstream tool for all of this (CommandBox CLI) is a stand alone binary that you can drop onto any machine that has Java and it will use the Windows registry, env vars, folder conventions, and the PATH to rustle up any java binary it can find to use. Not only do I have little to no control over the JRE, the very nature of the CFML app servers is a highly dynamic JIT compiled JVM language which could classload any conceivable java library out there that's bundled with the end users web app, and that essentially makes it impossible to ever know ahead of time what classes may or may not be class loaded at runtime. So yeah, the jlink stuff is really cool, but I doubt I'll ever be able to use it for my tool which promises a swiss army knife servlet server that can run any app. And even if I could, I'm not sure I'd want to. Outside of pre-compiled Java apps in a Docker container, I've never cared for the idea of a tool bundling its own JRE. I don't want to have 50 JREs on my hard drive if I have 50 tools that require Java. |
RE: the error. I think I know what's going on. From looking at the uberjar, you're also using Notify.... and there might be jar version conflicts. I'll go through and update notify + tweenengine (and whatever other deps you've included in the uber-jar) this weekend. |
Ahh, that would make sense. I did check ensure there were no updates to the Notify library, but it didn't occur to me you may not have tested them together. We use both the system tray and the notify library at the same time and it's so seamless, I sometimes forget they are actually separate libs. I'm so used to immediately seeing the toaster popup confirming my action when I click an item in the system tray menu. I'll look forward to testing the updated Notify lib alongside system tray. |
Still working on updating all the projects. There is... a lot. |
Done with the updates -- fixing an issue where |
Excellent, I'll grab the latest Notify and give it a shot once I see it pop into Maven (3.7 is still the latest at the time I write this) |
I've finished updating libraries. The API for Notify has changed slightly. Can I send you the jars for notify + systemtray (the dependencies are on maven) to make sure it's working as expected for you? |
Sure. You can reach me at brad at bradwood.com |
Hi @dorkbox and thanks for all the work! It took me some time to figure out the new API changes, but I have my project compiling on the latest versions with the following changes. Changed the imports
to
I had to remove the import and usage of I changed calls like
to
Is that correct? And calls like
to
Is that correct? I had to remove calls to
in the Notify builder as I'm not sure what the replacement is for that. Maybe you can help there. Doing all of that allowed my code to compile, however I'm not getting good results when I start up the process which creates the tray menu. These are used in the context of starting up a server where
For reference, in the PREVIOUS version of Notify and SystemTray, this is what those looked like: And, here is the console output on the old WORKING versions
On the new versions of Notify and SytemTray, the Notify popup simply doesn't appear at all. The tray icon and menu are present, but the menu items have no text or images, the submenus don't work, and clicking the menu items does nothing. Also, there are errors in the console about loading image files. Here is what the new non-functional tray looks like: And here is the console output:
The stack trace and error is repeated 5 times-- probably for each icon used. The icons being used can be found here: I can't find any errors in the logs that seem related to the Notify not working. It just seems to be failing silently. Please let me know if there's more information I can help provide or maybe some steps I've missed to use the new version of the library correctly. As a reference, here is the basic code using Notify |
I'll take a look! |
For the most part, it's right.
is what you're looking for. I'm looking at the rest. |
This code does not compile (cannot find symbol) :
Did you perhaps mean this?
|
Yup, sorry -- that was kotlin notation! Yours is correct for Java notation. |
do you have a branch I can check out and build? I'm not sure why it's not working properly for you. |
Hmm, I can commit it to a branch, but I'm not sure how to have you test it. SystemTray and Notify are embedded in a Java library that's embedded in a CFML-based CLI tool. And while it's incredibly easy to just grab the CLI and run
that's several layers removed from where the Dorkbox libs are plugged in. Ok, I've committed the changes to this branch https://www.ortussolutions.com/products/commandbox#download
It may be useful to know what OS you're on (for instance, the latest version of CommandBox disables the Dorkbox libs by default on MacOS due to all the issues we've had). I've only tried it on Windows thus far. If all this is a little too much to follow, I'd happily jump on a Zoom call or something just to show you how it works. I really appreciate you taking the time to help debug this and I'm very excited to get this new version up and running. |
I'll give that a go soonish. I'm currently working on some network issues, and can swap over once it's sorted.
You're welcome. My users have such different use-cases, and I just want something that works, and works well across a wide variety of systems. :) |
I am having a similar problem but only with openjdk with all versions from 9-19 if i start my program in oracle jdk it is running correctly.
|
I think i found out the problem cause.
|
@dorkbox Any luck yet with my instructions above on reproducing the issues? How can I help move this along? I'm working on a new major release of my tool and it would be great to have the systemtray and notify bits updated and working. |
@dorkbox Any new findings? |
I don’t know what happened to my GitHub notifications — but they were getting sent to my spam folder. I’m looking at this right now, and will have it sorted in the 4.5 release. |
Can you give this a test. I’ve updated a few pieces. |
Thanks for the ping. Just to confirm, this is the 4.5 release and it's already out on Maven? |
4.5 is waiting to make sure you don’t have any issues. I can always release it, then as necessary fix+release again (but I prefer not to) |
I can also just upload the current artifacts in this thread |
Hey @dorkbox, thank you for working on a fix for this issue. I have tested the latest version on CommandBox on macOS 14.2. On my machine the tray menu never shows up, and the console shows an error with the dpi and image size. Here is a stack trace [TRACE] Runwar: SystemTray Version: 4.5
[TRACE] Runwar: Settting SystemTray.DEBUG = true
[TRACE] Runwar: Initializing tray
[DEBUG] dorkbox.systemTray.SystemTray: Version 4.5
[DEBUG] dorkbox.systemTray.SystemTray: OS: Mac OS X
[DEBUG] dorkbox.systemTray.SystemTray: Arch: aarch64
[DEBUG] dorkbox.systemTray.SystemTray: Oracle Corporation OpenJDK 64-Bit Server VM 11.0.21
[DEBUG] dorkbox.systemTray.SystemTray: JPMS enabled: true
[DEBUG] dorkbox.systemTray.SystemTray: Is Auto sizing tray/menu? true
[DEBUG] dorkbox.systemTray.SystemTray: Is JavaFX detected? false
[DEBUG] dorkbox.systemTray.SystemTray: Is SWT detected? false
[DEBUG] dorkbox.systemTray.SystemTray: Auto-detecting tray type
[DEBUG] dorkbox.systemTray.SystemTray: Successfully added getLocation() to macOS AWT tray menus
[DEBUG] dorkbox.systemTray.SystemTray: Successfully added images/tooltips to macOS AWT tray menus
[ERROR] Getting DPI!94
[DEBUG] dorkbox.systemTray.SystemTray: Tray image size: 20
[DEBUG] dorkbox.systemTray.SystemTray: Tray menu image size: 16
[DEBUG] dorkbox.systemTray.SystemTray: SystemDPI: 94
[DEBUG] dorkbox.systemTray.SystemTray: System Scale: 1.0
[INFO ] dorkbox.systemTray.SystemTray: Successfully loaded type: Osx
[TRACE] Runwar: Initialized
[WARN ] dorkbox.systemTray.SystemTray: Please disable tooltips, as they are not consistent across all platforms and tray types.
[TRACE] Runwar: trying to load icon: /Users/userfolder/.CommandBox/cfml/system/config/server-icons/trayicon-lucee.png
[DEBUG] dorkbox.systemTray.SystemTray: Resizing image to 20 : /Users/userfolder/.CommandBox/cfml/system/config/server-icons/trayicon-lucee.png
[DEBUG] dorkbox.systemTray.SystemTray: Resizing image to 20 : /Users/userfolder/.CommandBox/cfml/system/config/server-icons/trayicon-lucee.png
[TRACE] Runwar: trying to load icon: /Users/userfolder/.CommandBox/cfml/system/config/server-icons/stop.png
[TRACE] Runwar: trying to load icon: /Users/userfolder/.CommandBox/cfml/system/config/server-icons/restart.png
[TRACE] Runwar: trying to load icon: /Users/userfolder/.CommandBox/cfml/system/config/server-icons/open.png
[TRACE] Runwar: trying to load icon: /Users/userfolder/.CommandBox/cfml/system/config/server-icons/folder.png
[TRACE] Runwar: trying to load icon: /Users/userfolder/.CommandBox/cfml/system/config/server-icons/folder.png
[TRACE] Runwar: trying to load icon: /Users/userfolder/.CommandBox/cfml/system/config/server-icons/home.png
[TRACE] Runwar: trying to load icon: /Users/userfolder/.CommandBox/cfml/system/config/server-icons/server_settings.png
[TRACE] Runwar: trying to load icon: /Users/userfolder/.CommandBox/cfml/system/config/server-icons/web_settings.png
[TRACE] Runwar: trying to load icon: /Users/userfolder/.CommandBox/cfml/system/config/server-icons/info.png
[TRACE] Runwar: trying to load icon: /Users/userfolder/.CommandBox/cfml/system/config/server-icons/folder.png
[TRACE] Runwar: trying to load icon: /Users/userfolder/.CommandBox/cfml/system/config/server-icons/home.png
[TRACE] Runwar: trying to load icon: /Users/userfolder/.CommandBox/cfml/system/config/server-icons/runAsync.png
[TRACE] Runwar: trying to load icon: /Users/userfolder/.CommandBox/cfml/modules/commandbox-fusionreactor/fusion_reactor.png
[DEBUG] Runwar: hooked system tray
[DEBUG] Runwar: Starting open browser action
[INFO ] Runwar: Server is up - http-port:8083 stop-port:50722 PID:69827 version 4.8.3-SNAPSHOT
[DEBUG] dorkbox.systemTray.SystemTray: Auto-fixing right-click for macOS system tray
[DEBUG] dorkbox.systemTray.SystemTray: Resizing image-stream to 16
[ERROR] dorkbox.systemTray.SystemTray: Error getting image size. Using error icon instead
java.io.IOException: Stream Closed
at java.io.FileInputStream.readBytes(Native Method) ~[?:?]
at java.io.FileInputStream.read(Unknown Source) ~[?:?]
at dorkbox.util.IO.copyStream(IO.java:123) ~[runwar-4.8.6-SNAPSHOT.jar:4.8.3-SNAPSHOT]
at dorkbox.systemTray.util.ImageResizeUtil.makeByteArrayInputStream(ImageResizeUtil.java:234) ~[runwar-4.8.6-SNAPSHOT.jar:4.8.3-SNAPSHOT]
at dorkbox.systemTray.util.ImageResizeUtil.resizeAndCache(ImageResizeUtil.java:165) ~[runwar-4.8.6-SNAPSHOT.jar:4.8.3-SNAPSHOT]
at dorkbox.systemTray.util.ImageResizeUtil.shouldResizeOrCache(ImageResizeUtil.java:362) ~[runwar-4.8.6-SNAPSHOT.jar:4.8.3-SNAPSHOT]
at dorkbox.systemTray.MenuItem.realizeImageFile(MenuItem.java:176) ~[runwar-4.8.6-SNAPSHOT.jar:4.8.3-SNAPSHOT]
at dorkbox.systemTray.MenuItem.bind(MenuItem.java:196) ~[runwar-4.8.6-SNAPSHOT.jar:4.8.3-SNAPSHOT]
at dorkbox.systemTray.ui.osx.AwtOsxMenu.lambda$add$0(AwtOsxMenu.java:88) ~[runwar-4.8.6-SNAPSHOT.jar:4.8.3-SNAPSHOT]
at java.awt.event.InvocationEvent.dispatch(Unknown Source) ~[?:?]
at java.awt.EventQueue.dispatchEventImpl(Unknown Source) ~[?:?]
at java.awt.EventQueue$4.run(Unknown Source) ~[?:?]
at java.awt.EventQueue$4.run(Unknown Source) ~[?:?]
at java.security.AccessController.doPrivileged(Native Method) ~[?:?]
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) ~[?:?]
at java.awt.EventQueue.dispatchEvent(Unknown Source) ~[?:?]
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) ~[?:?]
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) ~[?:?]
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) ~[?:?]
at java.awt.EventDispatchThread.pumpEvents(Unknown Source) ~[?:?]
at java.awt.EventDispatchThread.pumpEvents(Unknown Source) ~[?:?]
at java.awt.EventDispatchThread.run(Unknown Source) ~[?:?] |
The
SystemTray.get()
method is returningnull
. I'm not sure what you need to know, but here is the full output from the logger.Looking at the
CacheUtil
, it's referencingFileUtil.INSTANCE
on that line. The file util class appears to be Kotlin, not Java, but I don't see any references at all to anINSTANCE
property. Please advise.The text was updated successfully, but these errors were encountered: