I did it once when I compiled my “.java” file using javac; and then used jar to get a “.jar” outta the resultant “.class” file. 
However, I don’t remember exactly how I did it. I’ve read some articles in order to do it. 
You may start your search here I guess: 