I have an executable jar that has one class file with a wrong value. I requested that file from the author and corrected the value.
Now I want to compile it and add
You probably have to specify the JAR file itself and not just the directory it resides in.
javac file.java -classpath C:\folder\where\jar\is\the_jar_file.jar
You will want to compile your file like so:
javac -classpath C:\folder\where\jar\is\the_jar_file.jar file.java
per the javac usage instructions:
C:\Console2>javac -help
Usage: javac <options> <source files>
I'm just guessing, but did you check whether it doesn't need any external jar libraries you may have to include in your compilation command? Another thing you could do is to compile all of the classes by doing something like
javac *.java ...
As others have mentioned, once you have the .class file recompiled you need to replace the older version in the .jar
You'll likely need to have any compile time dependencies available to rebuild this class. If it's an open source project this could be an easy thing to come up with. If not, it's more difficult. If the author sent you the file he can probably help you with this as well. You might be able to get the author to produce a patched distribution for you as well. Odds are he/she already has the build environment set up and this should be relatively easy to do.
Once you've compiled the new file (such as in Mr. Will's answer), you can add the new file to the jar using:
jar uf C:\folder\where\jar\is\the_jar_file.jar file.class
I'd try this approach (and it should work, unless the 'debugged' class doesn't introduce a new error):
This should work. If not - ask the author for a new complete library.