Tutorial :How do I compile a Java application that uses Apache Commons IO at the command line



Question:

I made an application in NetBeans and I used the Apache Commons IO jar file. The application works fine in NetBeans, but I want to be able to compile it from the command line. The Apache Commons IO jar is with my *.java files but I get a commpiler error that says package org.apache.commons.io does not exist.


Solution:1

try

javac my_package/my_program.java -cp commons-io.jar   


Solution:2

Usually, Netbeans projects rely upon an ant file. As a consequence, you can compile on command line by locating this ant file, and calling its correct target.

Take a look at this forum message.


Solution:3

I gave up on this and just used BufferedWriter and FileWriter instead. Was much easier and worked great. Still don't know why Apache Commons IO wouldn't work for me...


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »