So I am trying to run a java file from Terminal. But the file is using the apache.commons.io lib, so a simple javac MyFile.java does not work here.
How do you include the libraries in Terminal?
11 Answer
You need first to install libcommons-io-java:
sudo apt-get install libcommons-io-javaThen use the installed jar file with javac this way:
javac my_file.java -cp /usr/share/java/commons-io.jarFrom the javac man pages:
-cp path or -classpath path Specify where to find user class files, and (optionally) annota‐ tion processors and source files. This class path overrides the user class path in the CLASSPATH environment variable. If neither CLASSPATH, -cp nor -classpath is specified, the user class path consists of the current directory. See Setting the Class Path for more details.