Search code examples
javaimportcompiler-errorscompilationjavac

Failing to import org.apache.commons


First line of MyCode.java is

import org.apache.commons.math3.distribution;

I am trying to compile via the command line with (I am on Mac OS X 10.12.4)

javac -cp "/Users/remi/Downloads/Java/commons-net-3.6/commons-net-3.6.jar"  MyCode.java

(the file really exist and it simply is in my downloads for the moment) but I get the error message

MyCode.java:1: error: package org.apache.commons.math3 does not exist
import org.apache.commons.math3.distribution;
                               ^
1 error

Can you help me out?


Solution

  • You are using the org.apache.commons.math3.distribution so you would need the apache math lib in your classpath. Thanks :)