I have .class and .java files in JAR archive. Is there any way to extract only .java files from it? I've tried this command but it doesn't work:
jar xf jar-file.jar *.java
You can use the unzip
command which accepts wildcards in its arguments (which is not the case of the jar
command). Something like this should do the trick ( disclaimer : not tested)
unzip youFile.jar "*.java"