views:

83

answers:

1

I have this .JAR file. I decompiled it to multiple .java files. There is any way to have a new functional .JAR file, after updating a single .java file and recompiling it? If it is possible how would we recompile this .java file without having it's dependencies? (ie. external libraries)

+5  A: 

Of course!

Ask javac to

javac -cp <whatever classpath you have> path/to/YourClass.java

after that you would say

jar uvf yourjar.jar path/to/YourClass*.class

and you're done, your .jar have been updated, now deploy it!

Remember, .jar file is just a zip archive with classes and manifest!

If your java source references any external classes, you'll need them around. But you also need them around for actually using the compiled class, so I guess it's not a huge problem.

alamar