Building on OS X: java.lang.NoClassDefFoundError: org/languagetool/server/PortBindingException

Hi there,
I’m trying to build LanguageTool from the git repo. While I can package it successfully with ‘mvn clean package’, I get this error when I try to run ‘java -jar languagetool-standalone-3.2-SNAPSHOT.jar’:

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/languagetool/server/PortBindingException
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
	at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
	at java.lang.Class.getMethod0(Class.java:3018)
	at java.lang.Class.getMethod(Class.java:1784)
	at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
	at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: org.languagetool.server.PortBindingException
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 7 more

I’m using Maven 3.3.9 (from Homebrew) and Java JDK 1.8.0_65 on OS X 10.11.1:

% mvn -v
Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T16:41:47+00:00)
Maven home: /usr/local/Cellar/maven/3.3.9/libexec
Java version: 1.8.0_65, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre
Default locale: en_GB, platform encoding: UTF-8
OS name: "mac os x", version: "10.11.1", arch: "x86_64", family: "mac"

If I double-click the same JAR, it fails silently - I assume that the same error is happening in the background.

Any ideas what I could be doing wrong?

Thanks in advance!

Graeme

Hi, thanks for your report. The *.jar in the target folder is, in the case of the stand-alone package, incomplete. You need to unzip the *zip and use that (or just go to the LanguageTool-3.2-SNAPSHOT/ folder) and then run “java -jar languagetool.jar”.

Aha! That makes more sense.

Thanks for your help!

Graeme