-
Notifications
You must be signed in to change notification settings - Fork 15
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
<Unknown device> as device name with javapackager bundle, or under OpenJDK 11 #29
Comments
Hello, thanks for bringing this to my attention. I have also been using (As an aside I just want to make sure you realize that Oracle Java 8 is past end-of-life, and if you are distributing software—even free software—using it, you are legally required to purchase a commercial license from Oracle at great expense. To protect yourself I would recommend you migrate to using OpenJDK instead, which has no such expensive licensing requirements nor hordes of angry lawyers to back them up. Amazon is offering long term support for both JDK 8 and 11 in their Coretto offering.) However, If you can find a way to fix this in your own investigations before I do, a pull request would be very welcome. |
A bit more testing confirms that it is only the CoreMidi4J devices whose names are unknown when running in the app-bundled JDK; the It’s going to be extraordinarily tedious to debug, though, since I am going to have to package an überjar and build it into an application bundle every time I want to try something. So, @DerekCook do you have any guesses as to what might be going on, or what I might want to add as debugging statements, to help reduce the iteration count? |
Hi. Not really. Can't say I have seen anything like this or understand why JavaPacker causes this issue. Note I do not use JavaPacker, so do not have a clue as to where to start with it. In the autumn I will be looking at if I can migrate to a later version of Java now for my librarians including packaging the JRE (now I have decent broadband via a 4G package), so obviously will have an interest in this when I get there. I was also thinking it might be time to rebuild CoreMIDI4J for later Java versions, now JRE 7 and 8 are end of support, but let's sort this issue first. |
I have found that the problem is the native launcher that javapackager creates inside the app. I extract the content of the app, and then noticed that if launch the .jar double clicking it everything worked fine, but if I launch with the native launcher, it failed. So I replaced the native launcher by a bash script with a java -jar ... command, and repackage using Packages application. This solution worked for me... |
And thanks for the info, we will move to OpenJDK... |
OK, that is good news that you have a solution. I need to move to OpenJDK myself, but first need to investigate a problem that screws up MIDI names on Windows, which stopped my from migrating to J9. Hopefully they have fixed it now. If you're happy that you have a solution, I will close this issue, especially as James points out that JavaPackager is no longer supported. |
Yes this solution is ok for me, thanks for your support.... |
Thanks. I will close this issue then. If you need to come back to it, then we can always reopen it. |
@iaguilera could you please give me more details of exactly how you implemented your solution? I would like to try it myself. What is the native launcher inside the package, and how do you get the package to run |
And @DerekCook you should be able use Amazon’s Coretto version of OpenJDK without moving past JDK 8 if you want to, they are offering free long-term support for that as well, even though Oracle has stopped. Check whether it is compatible with your license, though. |
Yes of course, I did this steps:
#!/bin/sh Give the file permissions to execute. The Xdock:icon parameter is needed so the Java app shows the app icon on the dock when executing, and not the default Java icon.
9 I didn't codesign the package, but I think you can do it with Packages, I don't think it's a problem...
Hope that helps |
And what if I am using an old version of the JDK / JRE, it applies the license of the time it was published isn't true? I want to self content the JRE, but not the latest version, but a version of past year that I checked and I know my app is working perfectly. |
Thank you for those steps, they give me a good starting point for my own experiments. Is this the Packages you are talking about? As far as JDK 8 licensing and distribution goes, I am not a lawyer, and it is very complex. I don’t believe you will be able to obtain current versions from Oracle with security patches for distribution unless you purchase a commercial license. If you are willing to ship older versions with known security vulnerabilities, you may be fine, but I personally switched to OpenJDK last year to be safe (and remain current with security updates). The good news is that it worked just fine for me. |
Yes that's the Packages software I used to create the installer for the app... And of course the future is move to a new version of OpenJDK we will do the same... |
Unfortunately, the workaround didn’t work for me, and in fact the problem seems to be deeper. In my application bundle, there is no JRE (because JDK 11 and later no longer have this concept), so the path had to be slightly different. But also, Once I had done that, I was able to get the application to launch using your script approach, but sadly that did not bring back my device names. Then I started digging deeper, and I discovered that even if I do not use So I am going to reopen this because it remains a problem for me, and is one even without |
The plot thickens… After uncommenting the debug statements in Thread 32 Crashed:: Java: AWT-EventQueue-0 |
Ok, I have figured this out. It is an actual bug in CoreMidi4J. We are using CFStringGetCStringPtr to obtain C string pointers from Core Foundation String objects. Unfortunately, as documented in the above link, while this is a very convenient function when it works, you cannot assume it will work, it is free to return
And, for whatever reason, from JDK 11 and I have modified the code to use a safer function which allocates memory for the strings and always works, but of course this means we need to free them as well after we pass them to the Java constructor. This fix is working for me. I will clean it up a bit more and push it to GitHub and Maven Central as a snapshot of 1.2 so you two can test it as well. Then if it looks good, we can release it. |
All right, the snapshot build of release 1.2 is uploading to Maven Central now. Please let me know when you have a chance to see if it lets you use the normal native launcher, @iaguilera |
Whoops, I made one more small change, so that (like in the original code) it uses the system encoding for the CFStrings, rather than assuming UTF-8, which the sample code I’d based the solution on was doing. I have updated the snapshot on Maven central as well. |
Thanks, James. Sounds like you’ve been productive on this! I reopened the issue as well given that it was deeper than originally thought, but then noticed you had already reopened and closed it! On reflection I’d like to keep it open until I get a chance to check the new build on my system. Which might not be for a few days (more likely the weekend) |
I’d really like to get a release out today so that I can finalize the release of Beat Link Trigger that I planned for this long weekend (it’s Labor Day in the USA), but I also realized overnight that I want to scan for anywhere else we might have used the problematic function. I’ll leave the issue open regardless. If you’re going to be spending the time to test on your own system, I think I will merge the build modernization branch (switching from If I do end up releasing 1.2 for incorporation in Beat Link Trigger and then you find new issues in your testing, I can release 1.3 once we fix those. But I may also just hold off on my own release. There are other features and fixes I’d love to make available to people who don’t install their own Java environment, but another week won’t kill me. 😄 |
Ok, I have merged in the branch that fixes #30 as well, and everything seems to be working nicely, I look forward to hearing how both of your testing goes when you have time. |
Oh, just as a reminder, my previous comment means that the minimum JDK for using the Maven build process is now 1.8, though it still compiles for use in 1.7 or later. I should figure out how to update the |
Thanks, James. Lots going on in work right now, and I'm in the middle of a pervasive problem in writing a librarian for a Roland FC300 foot controller, where I don't want to lose what is in my head (a first in first out buffer of small size these days ! :) ). So I do not think I will get around to it for a little while. Once I have my FC300 editor under control and ready for release, then I want to revisit the Windows MIDI Port Name issues I was having on JRE9 and see if things are better on later JREs. If not we might need a CoreMIDI type SPI for Windows as well! So I will do a quick check of your fixes as a working build as soon as I can, and then perhaps see what we want to do next (if needed) slightly longer term. PS: It's hard to believe that CoreMIDI4J has passed its 3rd birthday now, and nearly at the 4th ( I was working on the first implementation over Christmas 2015)! Notwithstanding this new issue, it's stood the test of time pretty well! |
Indeed it has, I was actually surprised to find anything to fix in it, and delighted to hear that more people are using it. Oh @iaguilera if you are willing to test the fix, in case you aren’t familiar with how to work with Maven snapshots: update the dependency version of With that, I believe you should just be able to use Once we release a final 1.2 release, you will want to update your dependency to that, rather than the snapshot, and you can then remove the |
(And speaking of old projects, Derek, I heard from someone today asking if I was going to update DisplayWatcher, which I had not touched since 2004 and had quite forgotten about, to work with macOS Catalina! I need to migrate that from CVS to git, and publish it on github, so it won’t depend on my single copy of the source, or availability of time.) |
I also just fixed another issue I found when building the project under JDK 11. In that circumstance we need to specify the source version for the |
I would like to try the fixes, but I'm not using Maven, I added the .jar dependency to my Netbeans project... |
Ah, well let me see if I can put a jar here. |
Thanks! I will test tomorrow and give you feedback |
Excellent! I will hold off on a release until you can do that. (And, I think you probably know this, but you will want to unzip the jar I uploaded before substituting it for the one in your netbeans build.) |
Yes I unziped the file, it's ok |
Great. Derek, I also just made a tweak to the |
I have tried to pack my application with javapackager and coremidi4j-1.2, and it works perfectly with this version, name of the MIDI devices are shown now without problems... |
That’s great news, thank you for verifying my fix, and hopefully that will save you some trouble in the future! We will close this issue once there is a non-snapshot build released, and you can update at that time, but you should be fine using the snapshot build until then. |
Ok thanks a lot for your support :-) |
@iaguilera thanks very much for confirming, and of course kudos to James for finding the cause and finding it so quickly. It will be a little while before I get the time to look at it. Hopefulyl I wil get to try the new build on the weekend, but I have every confidence it will be fine. |
Hi, I finally got some downtime tonight, so have checked the snapshot build out with my an.factory librarian against my AN1x - the most portable synth I can bring to my Mac!! - and also with my new fc.factory librarian in development for my FC300 MIDI foot controller. SYSEX import and export on both are looking good, so I think we can go for release based on our collective testing. Later in the autumn, when I have a bit more time, I think we then need to look at "what next" Cheers |
Excellent, thanks so much, Derek, that was fast! 😄 I will publish a release tonight, and then can release Beat Link Trigger this weekend. I would also be happy to help think about next steps, although I must say I am very happy with the library as it exists today. |
All right, Version 1.2 is released and published to Maven Central. @iaguilera if you would like to update to the official release version, you can find it on the releases page. |
Thanks a lot, I'm going to update my project with the official release version :-) |
My app works fine in Mac Os X until I package it with javapackager, selfcontaining Java 8 runtime. Then, some device names are reported as "Unknow devices". If I extract the .jar files from the package and run them, MIDI device names are ok...
IAC Driver device show name ok, only fails with my USB MIDI controllers...
So is an issue that only happends when creating a .app with javapackager.
Any help please?
The text was updated successfully, but these errors were encountered: