• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 857
  • Last Modified:

Java Help - JAR File

Dear Experts,

I have a jar file with 2 main classes. I want to execute the jar file specifying some input to start with different main program at different times. How to do that?

package order:
com.utility
-mainclass1.class
-mainclass2.class

It is packaged into classes.jar.

Best Regards.
0
StealthyDev
Asked:
StealthyDev
4 Solutions
 
ksivananthCommented:
write a batch/script file, which takes the input and launches the appropriate class!
0
 
objectsCommented:
java -cp classes.jar com.utility.mainclass1


java -cp classes.jar com.utility.mainclass2
0
 
Gurvinder Pal SinghCommented:
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
StealthyDevAuthor Commented:
Can you please send the content of batch file?

I normally use:
java -jar jarname.jar
0
 
ValeriCommented:
0
 
StealthyDevAuthor Commented:
Thanks to objects and all other experts who replied in seconds..

Thanks again!

Solution I have used:
java -cp classes.jar com.utility.mainclass1
java -cp classes.jar com.utility.mainclass2


Regards.
0
 
ValeriCommented:
ops, soory! :-)
First of all get familiar with MANIFEST.MF file and you will fix this.
0
 
StealthyDevAuthor Commented:
@Veleri: How to specify multiple Main Class in MANIFEST.MF ?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now