So, I have two jar files. Foo.jar, and Bar.jar.
Bar.jar has a Main.class holding
public class Main {
public static String bob(){
return "bob";
}
}
And then in Foo.jar, i want to be able to access the “bob” method, without including the jar as a library or resource or anything like that.. It’s just going to be a completely separate jar.. Is that even possible..?
Sorta like this
System.out.println(BarAsJarFile.Main.bob());
I don’t understand why you cannot set the classpath when you start the JVM (you can easily include multiple jar files that way), but it is possible to add jar files to your classpath later programmatically.