title: Building DeepLearning4j from source: NoClassDefFoundError org.nd4j.linalg.factory.Nd4j
body: <p>Off on and for several months now, I've been trying and failing to build DL4J from source. I've even tried different distros, to no benefit. The closest I've come is using Ubuntu 19.10. <code>mvn install -DskipTests</code> works but the <code>mvn clean test -P  testresources,test-nd4j-native</code> recommended at <a href="https://deeplearning4j.org/docs/latest/deeplearning4j-build-from-source" rel="nofollow noreferrer">https://deeplearning4j.org/docs/latest/deeplearning4j-build-from-source</a> produces the error below once the build gets to nd4j/nd4j-backends/nd4j-tests. The Ubuntu 19.10 is running on a VirtualBox with 28GB and 6 hyperthreads allocated to it.</p>
  
  <pre><code>testSystemInfo(org.nd4j.systeminfo.TestSystemInfo)  Time elapsed: 0.034 sec  &lt;&lt;&lt; ERROR!
  java.lang.NoClassDefFoundError: Could not initialize class org.nd4j.linalg.factory.Nd4j
      at org.nd4j.systeminfo.SystemInfo.getSystemInfo(SystemInfo.java:159)
      at org.nd4j.systeminfo.SystemInfo.printSystemInfo(SystemInfo.java:419)
      at org.nd4j.systeminfo.TestSystemInfo.testSystemInfo(TestSystemInfo.java:25)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:567)
      at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
      at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
      at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
      at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
      at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
      at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
      at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
      at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
      at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
      at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
      at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
      at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
      at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
      at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:567)
      at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
      at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
      at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
      at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
      at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
  
  </code></pre>