Answers for "Where can I find jar file?"

3

java get location of jar file

//this worked for me
File jarDir = new File(ClassLoader.getSystemClassLoader().getResource(".").toURI());

//this didn't work for me but it is often suggested
File jar = new File(MyClass.class.getProtectionDomain().getCodeSource().getLocation().toURI());
Posted by: Guest on June-24-2020
0

create a JAR file containing the class file

jar cvf jar_name.jar class_you_want_in_jar.class
Posted by: Guest on June-26-2020

Code answers related to "Where can I find jar file?"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language