When I'm in Eclipse my project compiles with no errors, however when I try to compile with javac
it says I'm missing some packages...
I copied my compile command and some of the error text below:
javac -classpath lib/ -d bin/ src/*.java src/Cleaner.java:5: package net.sourceforge.jgeocoder does not exist src/MyUtilities.java:19: package org.apache.commons.codec.binary does not exist
In Eclipse, I have added all the .JAR files to the build-path, and the program compiles just fine.
Why can it not find the jars when I use javac instead of the Eclipse IDE?
Extension classes - Classes that use the Java Extension mechanism. These are bundled as . jar files located in the extensions directory.
JAR files are packaged in the ZIP file format. The unzip command is a commonly used utility for working with ZIP files from the Linux command-line. Thanks to the unzip command, we can view the content of a JAR file without the JDK.
Right-click on the JAR file. Go to “Open With Other Applications”. Select Show other applications. Select Open With OpenJDK Java X Runtime.
-classpath lib/
will cause javac
to look for a tree of class files in lib
. If you have JAR archives there, you have to use -classpath lib/*.jar
- and probably use whatever escaping mechanism your CLI has on the * to make sure it reaches javac
rather than being expanded by the CLI
See the javac command reference (windows).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With