[Guide] Running VP on FreeBSD!


#1

Hi gang!

Warning: this guide is highly technical and meant for users who are well familiar with FreeBSD’s ports collection, regular command line usage, and editing of (Visual Paradigm) system files. Although this is a guide it only targets the specific problems you’ll encounter when trying this. Therefor basic steps such as downloading Visual Paradigm and installing it are not explained.

Editorial

FreeBSD is an open source Unix-like operating system which is somewhat comparable to Linux. Of course you can’t really compare the two; it’s like saying that Windows is somewhat comparable to macOS because both use a graphical user interface as their main environment. For example; unlike Linux FreeBSD actually has direct ties into a real Unix environment called BSD Unix, and this is also showing in the way the OS is set up and developed.

BUT… Back to Visual Paradigm! :slight_smile:

Dell + FreeBSD => KDE + Visual Paradigm :hugs:
…but it needs some serious tweaking!

I recently got hold of a Dell PowerEdge tower model and figured I’d run FreeBSD on it. Normally none of my servers use the graphical X / Xorg environment because the commandline is all I usually need, but because this is a 64bit environment with plenty of memory I figured why not. So I also installed X, KDE4 and some other utilities such as NetBeans. And that just cried out for Visual Paradigm :sunglasses:

Visual Paradigm is available for several platforms: Windows, MacOS, Linux and Unix. And the latter is a little bit of a free for all because VP depends on several features which need to be present. And that’s not always the case…

Some of the problems you’re going to encounter

OpenJDK8 does not provide JavaFX

As you may know Visual Paradigm is developed in Java, which is the main reason why I can even do this. FreeBSD’s ports collection provides a free Java environment called OpenJDK, it is available as java/openjdk8. Unfortunately it does not include JavaFX which is being used by VP. Although this won’t prevent VP from running you are going to get tons of error messages in your logfile.

There is a free JavaFX clone available called java/openjxf8-devel but I haven’t experimented with this yet. Which is mainly because I had quite some issues with trying to solve the next item:

No native SQLite support

VP heavily relies on SQL for its projects, and this is provided by the SQLite library. This library is available on FreeBSD and its called databases/sqlite3. The Java driver is called java/sqlitejdbc.

Unfortunately it turned out that merely providing these libraries wasn’t enough to get VP to work:

As you can see it specifically complained about not being able to use SQLite which made the application crash / stall. Not surprising if you consider that all of VP’s data files (our projects) are also saved in an sqlite format. So not having SQLite support is a big problem here…

How to solve this? Well…

Option 1: Replace VP’s sqlite library with the FreeBSD native version

If you check the VP program folder you’ll notice that it provides several libraries of its own:

omicron:/usr/local/Visual_Paradigm_14.2/lib $ ls
ant.jar                         lib09.jar
derby.jar                       openapi.jar
jniwrap.jar                     platforminstaller.jar
lib01.jar                       platforminstaller_backup1.jar
lib02.jar                       startsde.jar
lib03.jar                       vpplatform.jar
lib04.jar                       vpserver.jar
lib05.jar                       vpserverres.jar
lib05.jar_bck                   winpack.jar
lib06.jar                       xalan.jar
lib07.jar

Closer inspection learned me that lib05.jar is actually the file which provides sqlite. Unfortunately FreeBSD support is not included which is exactly why I got those error messages (note; I cropped the output):

$ unzip -l lib05.jar_bck | grep native
        0  08-06-14 23:28   org/sqlite/native/
        0  08-06-14 23:28   org/sqlite/native/Linux/
        0  08-06-14 23:28   org/sqlite/native/Linux/amd64/
        0  08-06-14 23:28   org/sqlite/native/Linux/i386/
        0  08-06-14 23:28   org/sqlite/native/Mac/
        0  08-06-14 23:28   org/sqlite/native/Mac/i386/
        0  08-06-14 23:28   org/sqlite/native/Mac/x86_64/
        0  08-06-14 23:28   org/sqlite/native/Windows/
        0  08-06-14 23:28   org/sqlite/native/Windows/amd64/
        0  08-06-14 23:28   org/sqlite/native/Windows/x86/

As you can see: no native/FreeBSD/amd64, which is what I needed.

So one easy messy way to solve this is to simply replace lib05.jar with the native FreeBSD library. If you installed java/sqlitejdbc then you can find this file in /usr/local/share/java/classes/sqlitejdbc-native.jar. Just rename lib05.jar into something else and then copy this file and rename it to lib05.jar:

$ mv lib05.jar lib05.jar_bck && cp /usr/local/share/java/classes/sqlitejdbc-native.jar lib05.jar

This should be enough to get Visual Paradigm to work “somewhat” but with a heap of error messages (this is a work in progress!).

Build your own driver

The sqlite-jdbc which is provided in the FreeBSD ports collection is called sqlitejdbc and was developed by David Crawshaw of Zentus. However, the driver used by VP is called sqlite-jdbc and its licensed under the Apache 2.0 open source license. Which means that we can roll our own…

Fun fact: the library used by Visual Paradigm is maintained by Xerial and actually a fork of the Zentus library. This is why my previous replacement easily works. However, this library provides a lot more functionality, therefor it’s a better idea to build a native version for FreeBSD.

The project is hosted on GitHub so its easy to obtain the source code:

$ git clone https://github.com/xerial/sqlite-jdbc.git

This is a GNU based project, so you need to have gmake available. If it isn’t then grab it from the ports collection: devel/gmake.

You’re also going to need several libraries in order to compile this, when in doubt just use Maven to sort out all the dependencies and build the project.

At the time of writing I finished building the library, but instead of trying I’m writing this post first :wink:

And the result so far?

So far, so good. As you can see in the background it still triggers some error messages, mostly related to JavaFX and some missing sqlite functionality, but I’ll explain more about that in the next part, coming later this week.

This is a good example why open source and in this case more so open standards are such a big deal. It provides us, the users, with enough control to make things work even if the environment isn’t officially supported yet.


#2

It works!

If you look closely to the command line window (the green text) then you’ll notice that there are no error messages shown after “Workspace: /home/peter/VisualParadigm/ws”, which is exactly what I was trying to achieve.

So as you can see you can get Visual Paradigm to work on FreeBSD but it requires tweaking.

How to make it work (fully tested / worked out instructions).

  • Install java/openjdk8 and java/freejfx8-devel.
  • Grab a copy of the SQLite JDBC driver source, and compile it.

It needs some specific steps:

  • Set JAVA_HOME: export JAVA_HOME=/usr/local/openjdk8
  • Make sure you have gmake installed (devel/gmake) and use that for building, so just issue gmake.

The build process will probably end with an error about Docker missing. Don’t mind that because it has already done what we needed. So now to build the jarfile:

$ cd target
$ jar cvf lib05.jar -C common-lib org
$ jar uvf lib05.jar -C classes org

And finally: replace this file (lib05.jar) with the existing one in your Visual Paradigm installation directory. So I’d issue:

$ cp lib05.jar /usr/local/Visual_Paradigm/lib

Warning: this will overwrite your existing library. But that shouldn’t matter too much because in its current state Visual Paradigm won’t run anyway :wink:

I’m super excited about this discovery because it brings me back to 2006 or so. Fun fact: I discovered Visual Paradigm while I was using Linux (and KDE) as my main desktop. I ran NetBeans on Linux and got myself the sde-nb license so that I could use it within NetBeans.

… which is what I’ll be setting up next, but that’s a diferent story :slight_smile: