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.
-
Please provide command you ran and error you gotMykola Golubyev– Mykola Golubyev2010-03-12 16:28:42 +00:00Commented Mar 12, 2010 at 16:28
-
Mykola, I use the exact command you posted: javac my_package/my_program.java -cp commons-io.jar The errors I get tell me that my other class files cannot be found. "my_program.java" is my main class but I have 3 other *.java files that "my_program.java" depends on and one of those classes needs the "commons-io.jar" library.ubiquibacon– ubiquibacon2010-03-12 18:33:45 +00:00Commented Mar 12, 2010 at 18:33
Add a comment
|
3 Answers
try
javac my_package/my_program.java -cp commons-io.jar
3 Comments
ubiquibacon
Thought I had it. It compiled with out error but when I checked the folder no class files were created. Any thoughts?
Stephen C
@typoknig - my thought is that you would do well to read the javac(1) "manual page" relevant to your platform; see java.sun.com/javase/6/docs/technotes/guides/javac/index.html
ubiquibacon
Yes, that is basically the same info that javac -help gives me, but following that as I understand it right now is not getting the job done for me, thus the question. If my package was named "my_package" and my program was named "my_program" and all of my *.java files and my apacheCommonsIo.jar file were in a folder named "my_package" located directly on the (c:) drive what exactly do I need to type to type at the command line to make it all work?
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.