How can I install the JAR files (including plantuml.jar) for PDF output, so that I can use PlantUML in any directory?

0 votes
asked May 23, 2018 in Bug by anonymous
I can use PlantUML to compile a PlantUML script into a PDF image, as long as I place all the JAR files and the PlantUML script in the same directory.

How can I install the JAR files (including plantuml.jar), so that I can use PlantUML in any directory without copying all the JAR files to each directory that I use PlantUML in?

I plan to use PlantUML to compile PlantUML scripts to PDF files in different directories.

However, I do not want to copy PlantUML files to each (current) working directory.

Thank you so much, and have a good day!

1 Answer

0 votes
answered May 30, 2018 by bugz in a jar (160 points)

This answer is pretty basic advice for how to access any binary conveniently. As with any binary on any system that supports terminal style inputs (e.g. bash shell or Windows Command Prompt windows), either the binary needs to be in a well-known location or you need to add a copy or a symlink to that binary in a well known location, or you need to provide the absolute path.

I created an executable script named "plantuml" to launch the jar file in command-line mode and put the executable script in my ~/bin directory, which is in my $PATH. I also put the JAR file in a stable location where I can conveniently run it by double-clicking on the JAR. The "plantuml" script I wrote is:

#!/usr/bin/env bash
java -jar /Users/trickydick/Applications/Developer/UML/plantuml.jar

Or you could put a line in your .aliases file that says:

alias plantuml='java -jar /Users/trickydick/Applications/Developer/UML/plantuml.jar'

So on systems with UNIX style command interpreter shells (e.g. bash shell) either of these should work fine, for JAR files or whatever.