fesch / Structorizer.Desktop

Structorizer is a little tool which you can use to create Nassi-Schneiderman Diagrams (NSD).
https://structorizer.fisch.lu
GNU General Public License v3.0
65 stars 19 forks source link

MacOS Catalina 10.15.7: Unable to load Java Runtime Environment #912

Closed omezger closed 3 years ago

omezger commented 3 years ago

Structorizer 3.30-14 don't launch by clicking on nsd-File or App

java version "15.0.2" 2021-01-19 Java(TM) SE Runtime Environment (build 15.0.2+7-27) Java HotSpot(TM) 64-Bit Server VM (build 15.0.2+7-27, mixed mode, sharing)

If I open the Package an click on /Applications/Structorizer.app/Contents/Java/Structorizer.jar it works fine. What shall I do? Thanks

fesch commented 3 years ago

Do you really need Java 15? I would suggest to uninstall that and use OpenJDK 11 from this link, which works fine. https://adoptopenjdk.net/

omezger commented 3 years ago

Ok, I removed all Java 15 VMs and installed https://adoptopenjdk.net/ Terminal shows: omezger@MezMacBook-Pro-16 ~ % /usr/libexec/java_home -V Matching Java Virtual Machines (1): 11.0.9.1, x86_64: "AdoptOpenJDK 11" /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home Deleted Structorizer, Restarted my Mac and tried it again with fresh unzipped App, with same Result 😢 . Could it be JavaAppLauncher because Structorizer.jar works still fine?

fesch commented 3 years ago

It could be ... but I have running Structorizer on a lot of Mac's at school running all kind of different OSX versions, even the latest Big Sur .... and there is no Problem.

fesch commented 3 years ago

So the question is: why does it not work :-(

Could you check the Console-App to see if there are any error messages thrown out there?

omezger commented 3 years ago

Did you mean Messages like this: Jan 20 20:17:06 MezMacBook-Pro-16 com.apple.xpc.launchd[1] (lu.fisch.Structorizer.28696[835]): Service exited with abnormal code: 1

fesch commented 3 years ago

Yes, that's at least a hint, even if nothing really to stick with :-(

omezger commented 3 years ago

I'm scared about all this s.... that I read there "all things are going permantently wrong" 😭 Information overflow Just trying to get more Info:

JavaAppLauncher omezger@MezMacBook-Pro-16 MacOs % JavaAppLauncher -v zsh: command not found: JavaAppLauncher ...feeling so stupid, forgot all being a teacher...

fesch commented 3 years ago

seams a problem with zsh. You may try this:

https://stackoverflow.com/questions/33935281/command-not-found-oh-my-zsh

omezger commented 3 years ago

There was no .zshrc File in ~/ my Home and I tried several things like your link in a new .zshrc with no success, just like there is no .zshrc file.. something strange with my 10.15.7.

omezger@MezMacBook-Pro-16 ~ % echo $PATH /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

good night

fesch commented 3 years ago

Just to be sure, could you check the content of the folder

/Applications/Structorizer.app/Contents/Java/Structorizer.jar/Contents/MacOS

Is there a binary name "JavaAppLauncher" which is executable? What happens if you launch it in the terminal with ./JavaAppLauncher ?

omezger commented 3 years ago

I think you mean /Applications/Structorizer.app/Contents/MacOS there is JavaAppLauncher .. Same Thing..

I updated a MacMini from HighSierra to Catalina and launched Structorizer and Umlet successfully without any Problem. Used /System/Applications/Utilities/Activity Monitor.app to check what Structorizer uses... On this machine is no installed JVM but Structorizer uses in /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/... from 2016

At my new 16' is nothing like this, I don' migrate from old System and don't uses the migration assistent to get a new clean system. But I installed some Java Dev Software like IntelliJ...

Next I will test it on a fresh clean Catalina-System and without Installed IntelliJ or Java 15 to check if there is the problem..

Thanks a lot for Support, I and my Students love your Software! At the moment I think the problem is on my site... Oliver

omezger commented 3 years ago

On a new fresh Catalina with installed https://adoptopenjdk.net/ Version 11 The problem is still there: Unable to load Java Runtime Environment. In /Library/Internet Plug-Ins/ no Plugins are installed. At my MacBook Pro 16' I fixed the problem coping /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/... from my migrated MacMini. So I think /Applications/Structorizer.app/Contents/MacOS/JavaAppLauncher needs the Plugin. % /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version

codemanyak commented 3 years ago

I am not at home on a Mac but the mentioning of a "JavaApplet" rings a bell. As the Java Applet (running in a browser) is regarded as a potential security risk, it will by default not be installed anymore, browsers often don't support it any longer, and class javax.swing.JApplet is deprecated since Java 9. Maybe it has something to do with it? Should we just kick the fading-out class StructorizerApplet.java (which still refers to javax.swing.JApplet) out of the project, perhaps?

fesch commented 3 years ago

The applet isn't online anymore anyway, so I think we could move it to "old files" too ;-)

But that is not @omezger's problem. On the Mac, up to Java 8, the "JavaAppletPlugin" was nothing else than a JRE and used by the system for running Java applications With Java 10 upcoming, this had been changed, but it seems to remain somehow deep down their system :-/

codemanyak commented 3 years ago

@fesch Okay, I am just guessing a little: Could there be a similar problem on the Mac like in the Windows registry as described in the User Guide (that an installed JDK isn't recognized, because the application only looks for a JRE)?

fesch commented 3 years ago

No, OSX is different :-/

omezger commented 3 years ago

Apps like BlueJ, Arduino, Freeplane bring their own JRE in the package: /Applications/Arduino.app/Contents/MacOS/Arduino /Applications/Arduino.app/Contents/PlugIns/jre1.8.0_242.jre/Contents/Home/lib/jli/libjli.dylib /Applications/Arduino.app/Contents/Java/apple.jar /Applications/Arduino.app/Contents/Java/batik-1.8.jar /Applications/Arduino.app/Contents/Java/batik-rasterizer-1.8.jar /Applications/Arduino.app/Contents/Java/batik-svgpp-1.8.jar /Applications/Arduino.app/Contents/PlugIns/jre1.8.0_242.jre/Contents/Home/lib/libverify.dylib /Applications/Arduino.app/Contents/PlugIns/jre1.8.0_242.jre/Contents/Home/lib/libjava.dylib /private/var/folders/hg/gxcvmc493cj8vyz6qk_bxz740000gn/T/hsperfdata_omezger/19590 /Applications/Arduino.app/Contents/PlugIns/jre1.8.0_242.jre/Contents/Home/lib/libzip.dylib /Applications/Arduino.app/Contents/Java/batik-ext-1.8.jar /Applications/Arduino.app/Contents/Java/batik-xml-1.8.jar

Structorizer uses the Internet-Plugin: Applications/Structorizer.app/Contents/MacOS/JavaAppLauncher /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/jli/libjli.dylib /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/libverify.dylib /private/var/folders/hg/gxcvmc493cj8vyz6qk_bxz740000gn/T/hsperfdata_omezger/19919 /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/libzip.dylib /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/server/libjvm.dylib /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/libjava.dylib /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/rt.jar

At fresh Catalina system with installed adoptopenjdk-11.jdk these Plugins are not installed, so the AppLauncher can't find the Java Runtime Enviroment. At my fresh system I can start Structorizer via /Applications/Structorizer.app/Contents/Java/Structorizer.jar And it uses the installed JRE at /Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/.. but I can't get access to many folders i.e. Desktop :-(

codemanyak commented 3 years ago

@fesch Is a solution in sight? Can we contribute to a solution at all? Should we give some relevant recommendations in the User Guide?

fesch commented 3 years ago

My test on a clean OSX Big Sur

fesch commented 3 years ago

@omezger : I've succeeded in integrating a JDK8 into the package, so that it should now start even on a system where no JDK is installed, but the overall package size increased significantly.

Could you please try?

omezger commented 3 years ago

Tested on my clean Catalina System: It works! I think you fixed it. Thanks a lot!

codemanyak commented 3 years ago

@fesch Oops. That has indeed become a heavy package! Maybe, on the long run the JDK can be replaced by a JRE. At least via the homebrew package manager there seems to be a more or less working way to generate a JRE from AdoptOpenJDK on GitHub (as part of the AdoptOpenJDK project): Homebrew-OpenJDK. I haven't checked this, though.

fesch commented 3 years ago

Yes ... I deleted the packaged source freeing up some 40MB but still heavy. Indeed, a JRE will be enough. I took the JDK because I had it ready from some other project, ;) but now that the way to go is clear, we can for sure optimize this!

Signing the OSX package is something else I would like to do, but I did not success in building zsign an none of the other methods worked out either ...

fesch commented 3 years ago

I will try this later on ...

http://www.balthisar.com/blog/bundle-the-jre/

fesch commented 3 years ago

@codemanyak : Using the above Link I was able to considerably reduce the size so that the final package shrinks down to about 50MB.

@omezger : Could you perhaps give the newly uploaded package a try?

omezger commented 3 years ago

Good shrink, but if I click at a nsd-File Structorizer starts but don't open the File. I tried this: Open file via Filemenue, allow access to the desktop, (setting is thereby saved in the system preferences Security, at Files and Folders) -> file is opened. Closed Structorizer, double click on the file, Structozier starts but the file is not opened.

codemanyak commented 3 years ago

@omezger Was this different with the prior ("fat") package? Or haven't you tried?

omezger commented 3 years ago

Sorry, I don't try this with the fat package and now its replaced :-(

fesch commented 3 years ago

This has nothing to do with the used JRE (either fat nor light) I think, but I can generate the fat package if you want to try.

codemanyak commented 3 years ago

This has nothing to do with the used JRE (either fat nor light) I think, but I can generate the fat package if you want to try.

I did not think so, either, but just wanted to make sure we don't look in a wrong direction.

omezger commented 3 years ago

Ok, I would try it with the fat one ;-)

fesch commented 3 years ago

@omezger : OK, the fat package is now again on the server.

omezger commented 3 years ago

The fat one works fine, the thin one not. The fat one don't border privacy-settings "files and folders", I can open nsd-Files with double click from everywhere.

fesch commented 3 years ago

Grrr ... so the question is: Why does the fat one work and the thin one not?

fesch commented 3 years ago

WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by lu.fisch.structorizer.gui.OSXAdapter (file:/Users/btsadmin/Downloads/Structorizer/Structorizer.app/Contents/Java/Structorizer.jar) to constructor com.apple.eawt.Application() WARNING: Please consider reporting this to the maintainers of lu.fisch.structorizer.gui.OSXAdapter WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release

fesch commented 3 years ago

So Java8 seams good with this but Java11 does not ...

fesch commented 3 years ago

Strange, I get the same messages with Java 8, but double-clicking a file is working ...

fesch commented 3 years ago

@omezger : I found a way to make it work with the thin package (that is now online!) Can you please confirm that it works for you too?

omezger commented 3 years ago

Seems to be ok!

codemanyak commented 3 years ago

I found a way to make it work with the thin package (that is now online!) Can you please confirm that it works for you too?

@fesch Would you mind explaining in a few words what the core of the problem was and how you solved it (not urgent, just out of curiosity)?

codemanyak commented 3 years ago

Would you mind explaining in a few words what the core of the problem was and how you solved it (not urgent, just out of curiosity)?

@fesch Oh sorry, I revoke my question - I see it in the code.

fesch commented 3 years ago

;-)

codemanyak commented 3 years ago

@fesch By the way and on occasion of #940: Could you please try to keep the JRE out of the Windows/Linux package? (Obviously, it is only used in an OS X context, anyway). If you keep the light-weight script stuff out of the Mac version, then it should also be feasible (and would make way more sense) to keep the relatively heavy JRE out of the other downloads.

fesch commented 3 years ago

yes, the JRE gets deleted from the directory before making the Windows/Linux package ... but my script still seams wrong. I will adjust it ...

fesch commented 3 years ago

Argh ... the name of the folder of the thin package changed, this is why it did not get deleted :-/