joethei / obsidian-plantuml

Generate PlantUML Diagrams inside Obsidian.md
MIT License
368 stars 18 forks source link

Local jar file didn't works #37

Open BaumiCoder opened 1 year ago

BaumiCoder commented 1 year ago

Is your feature request related to a problem? Please describe. I try to use the plugin with an local jar file. With a local file configured the rendering stops working and only the message "Generating PlantUML diagram" appears. Here is an small sample vault with configuration and description in it. PlantUMLTest.zip

Describe the solution you'd like I want to use the plugin with local jar file. Do I use a wrong jar file or is it a bug in the plugin?

Describe alternatives you've considered If I use the wrong jar file, maybe there should be a link / description which file is the correct one. A Option for automatically downloading the file would also been an nice feature. The file could be saves in the folder of the plugin. (I save my personally vault in a git repository and I don't want to save the big jar file in my repo, but the plugin should run with an local jar file on all of my computer where I use my vault.)

Additional context

hunterjackson commented 1 year ago

So I'm not sure about version 11 but I had issues using Java version 17, you can see the errors if you invoke the jar directly.

$ java -jar plantuml.jar 
Exception in thread "main" java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-17-openjdk-17.0.5.0.8-2.fc36.x86_64/lib/libawt_xawt.so
    at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2393)
    at java.base/java.lang.Runtime.load0(Runtime.java:755)
    at java.base/java.lang.System.load(System.java:1953)
    at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
    at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:388)
    at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:232)
    at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:174)
    at java.base/jdk.internal.loader.NativeLibraries.findFromPaths(NativeLibraries.java:315)
    at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:285)
    at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2398)
    at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:818)
    at java.base/java.lang.System.loadLibrary(System.java:1989)
    at java.desktop/java.awt.image.ColorModel$1.run(ColorModel.java:210)
    at java.desktop/java.awt.image.ColorModel$1.run(ColorModel.java:208)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
    at java.desktop/java.awt.image.ColorModel.loadLibraries(ColorModel.java:207)
    at java.desktop/java.awt.image.ColorModel.<clinit>(ColorModel.java:220)
    at java.desktop/java.awt.image.BufferedImage.<clinit>(BufferedImage.java:286)
    at net.sourceforge.plantuml.FileFormat.<clinit>(FileFormat.java:127)
    at net.sourceforge.plantuml.Option.<init>(Option.java:105)
    at net.sourceforge.plantuml.Run.main(Run.java:92)

So I installed Java 8 and I am now able to launch the jar directly however I still get the "Generating PlantUML diagram" message, I agree a better error message would be nice.

BaumiCoder commented 1 year ago

I had some other issues with obsidian lately. Now I find a reason for this.

reason for problems (flatpak)

I was using the flatpak installation of obsidian. Flatpak applications are running in a kind of an sandbox. So a java -jar plantuml.jar on the shell works fine (with OpenJDK 18), but the obsidian in the flatpak sandbox doesn't works (maybe there couldn't be found any java in the sandbox).

solution for problems

Now I installed obisidian as deb-package an with that all works fine.

ToDo for plugin

In my opinion the only ToDo for the plugin would be to show a error message, what went wrong while using jar file.

EndarValuk commented 1 year ago

I had some other issues with obsidian lately. Now I find a reason for this.

reason for problems (flatpak)

Same here, found bug when using flatpak version of obsidian. Tried setting java path to /var/run/host/{my_java_executable_path} fixed issue (see flatpak docs)

@joethei i think, that info should be added to Known Issues section.