I have a jar which contain two main class Class A and Class B. In the manifest i have mentioned Class A . Now i have to execute classB from the same jar . what should be the
Why don't you create a Main class that accepts an argument? That argument will decide whether to execute Class A or Class B then.
Use a command-line switch to identify whether Class A or Class B should be executed.
This will do the job: java -classpath yourjar.jar youpackage.B
java -classpath yourjar.jar youpackage.B