Running Freenet on FreeBSD

[linkstandalone]

Hi,
If you can't start the Freenet router under FreeBSD version 12.x and you get an error similar to this:

Your java executable at /usr/local/bin/java is a script... looking for alternatives...
Your java executable at /usr/local/openjdk8/jre/bin/java seems suitable
Unable to locate any of the following binaries:
    /usr/home/freenet/app/./bin/wrapper-freebsd-x86-64
    /usr/home/freenet/app/./bin/wrapper
Starting Freenet 0.7...

Let's start the node without the wrapper, you'll have to daemonize it yourself.
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/jna/Platform
    at freenet.support.ProcessPriority.enterBackgroundMode(ProcessPriority.java:63)
    at freenet.node.NodeStarter.main(NodeStarter.java:264)
Caused by: java.lang.ClassNotFoundException: com.sun.jna.Platform
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
    ... 2 more

It means you have to install the javaservicewrapper package and copy the wrapper binary in the bin folder of the freenet install. In our case, it'll be in /usr/home/freenet/app/bin/wrapper:

pkg install javaservicewrapper
cp /usr/local/lib/javaservicewrapper/bin/wrapper /usr/home/freenet/app/bin/wrapper
chmod 755 /usr/home/freenet/app/bin/wrapper

Now restart the router thanks to the run.sh script or the official rc.d script (don't forget to edit the run.sh script path and to put freenet_enable="YES" in your /etc/rc.conf:

$ service freenet start
Your java executable at /usr/local/bin/java is a script... looking for alternatives...
Your java executable at /usr/local/openjdk8/jre/bin/java seems suitable
Starting Freenet 0.7...