weirongxu / plantuml-previewer.vim

Vim / Neovim plugin for preview PlantUML

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Just gray

BenHerbst opened this issue · comments

grafik
I just get this gray image when I use PlantumlOpen. I use Windows 11.
My uml file:
grafik

What is your java version?

Java 17, openjdk

@BenHerbst
I had the same issue and went through the motions of making PlantUML work as described here with Java.

https://plantuml.com/command-line

After sorting out some of the dependencies (in my case I needed to sudo apt install openjdk-11-jdk) and being able to generate a sample image with the .jar file (e.g. java -jar ./plantuml-1.2022.2.jar test.puml), the plugin also started working.

I got the .jar file here

Hope that helps.

I have the same issue on macOS. I'm using a Homebrew-installed java (openjdk@11) and plantuml, which works fine on the command line. Even when I set g:plantuml_previewer#plantuml_jar_path correctly, PlantumlOpen shows only a gray screen and PlantumlSave doesn't output any files (nor does it display any images).

Is there an error log somewhere that might help narrow down the issue?

Hi @tysonmote @BenHerbst , I have added a g:plantuml_previewer#debug_mode option.
You set this option to 1 to print the error logging.

Thanks @weirongxu! This is the error I see when running PlantumlOpen for a valid .puml file:

Error detected while processing function <SNR>176__on_stderr[1]..<SNR>163_print_stderr:
line    3:
cp: /Users/tysonmote/.local/share/nvim/plugged/plantuml-previewer.vim/tmp/context.svg: No such file or directory

context.svg doesn't exist, but the rendered SVG does:

> ls /Users/tysonmote/.local/share/nvim/plugged/plantuml-previewer.vim/tmp/
foobar.svg

Hi, @tysonmote,
Did you specify filename of the diagram?

for example

@startuml foobar
...
@enduml

Yeah, I specified a file name.

I'm facing the same here

Hi, @tysonmote, Did you specify filename of the diagram?

for example

@startuml foobar
...
@enduml

FYI, After remove the filename of the diagram, it's show up

In my case I had installed openjdk through homebrew and it wasn't linked to the java wrapper on macos:

❯ java --version
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.

Symlinking openjdk fixed the issue:

sudo ln -sfn /opt/homebrew/Cellar/openjdk/19.0.1/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk
❯ java --version
openjdk 19.0.1 2022-10-18
OpenJDK Runtime Environment Homebrew (build 19.0.1)
OpenJDK 64-Bit Server VM Homebrew (build 19.0.1, mixed mode, sharing)

After this change the preview started working.

@stocks29

For the system Java wrappers to find this JDK, symlink it with
  sudo ln -sfn /usr/local/opt/openjdk/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk.jdk

Here command from brew install openjdk, fixed for me

commented

@aburd

After sorting out some of the dependencies (in my case I needed to sudo apt install openjdk-11-jdk) and being able to generate a sample image with the .jar file (e.g. java -jar ./plantuml-1.2022.2.jar test.puml), the plugin also started working.

Wait, so you have to have the .jar file in the current directory? I just installed plantuml with my package manager. Will it not work like that?

@d3jv
Sorry if my original post was confusing.

First off, I should say that this extension already includes a .jar file, so you shouldn't have to install one yourself.

However, what I was trying to say was in order to debug, I just tried to download the jar file that this project relies on and then open a uml file manually. In that process, I found that I didn't have the proper java installation. Solving that issue is what made this extension work for me.

Btw, for those who don't want to use the .jar file included with the pkg, it seems you can configure here:
https://github.com/weirongxu/plantuml-previewer.vim#variables

commented

@aburd

Oh, I thought that variable was to specify the path to a .jar file that would get executed with java --jar and that there was no way to use a packaged plantuml.

Thanks for the clarification.

It's a shame though that you can't provide command line arguments to the executable. For instance I'd really like to have it build the diagram with -charset UTF-8

Lots of things break int the way described here if you specify a document name after @startuml including the open and save commands. There's only one half-ass'd linux/*NIX PR #42 to fix the open issue but the save-as issues persists....it's just not worth giving the diagram a name until someone can fix all things properly. I was digging in a bit but it's kind of a time sink. The VSCode plugin must do something moar better as it doesn't have these issues but I wanna use vim ;).