2

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.

2
  • Please provide command you ran and error you got Commented 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. Commented Mar 12, 2010 at 18:33

3 Answers 3

2

try

javac my_package/my_program.java -cp commons-io.jar 
Sign up to request clarification or add additional context in comments.

3 Comments

Thought I had it. It compiled with out error but when I checked the folder no class files were created. Any thoughts?
@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
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?
0

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.

Comments

0

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...

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.