i wrote 5 programs and i have their jar files
now what i want is to make a main class that instantiate these 5 jars in loop again and again ..... is there any way to call the jar files in the java class ??
is there any way to call the jar files in the java class
You can't call jar file. Using java -jar you can invoke a particular class from the jarfile. But that requires Main-Class entry into the manifest.mf file of the specific jar file.
is there any way to call the jar files in the java class
You can't call jar file. Using java -jar you can invoke a particular class from the jarfile. But that requires Main-Class entry into the manifest.mf file of the specific jar file.
can you please provide me the demo or any Good link to understand it in depth??
If the JARs are correctly in your classpath, you don't even need to execute the java command. You can just call the main method of the class like any other static method, using "MainClass.main(...)", where MainClass is the class holding the main method, and ... are the parameters you need to pass.
need more explanation i developed all these programs in net-beans and each program is itself a project now i have to run these projects from single class
The main method is still a public static method. That means that you can call it from Java code as well, as long as the class is on the class path. Simply create a String[] with the arguments you want to pass to it, then call that method.
Rob Prime wrote:The main method is still a public static method. That means that you can call it from Java code as well, as long as the class is on the class path. Simply create a String[] with the arguments you want to pass to it, then call that method.
thanks Rob it really helps me allot ... now i am doing same as you said mean i made one main class that calls the main classes of five programs that i want to execute but now i have one more problem suppose each main class takes almost 10 mins to execute so programs takes 50 mins to execute... what i want is to start the all main classes at a time so that they will take 10 mins to execute