Solved

Java Help - JAR File

Posted on 2010-09-08
8
830 Views
Last Modified: 2013-12-14
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
Comment
Question by:StealthyDev
8 Comments
 
LVL 26

Assisted Solution

by:ksivananth
ksivananth earned 50 total points
ID: 33624696
write a batch/script file, which takes the input and launches the appropriate class!
0
 
LVL 92

Accepted Solution

by:
objects earned 350 total points
ID: 33624725
java -cp classes.jar com.utility.mainclass1


java -cp classes.jar com.utility.mainclass2
0
 
LVL 40

Assisted Solution

by:gurvinder372
gurvinder372 earned 50 total points
ID: 33624726
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 15

Author Comment

by:StealthyDev
ID: 33624728
Can you please send the content of batch file?

I normally use:
java -jar jarname.jar
0
 
LVL 16

Assisted Solution

by:Valeri
Valeri earned 50 total points
ID: 33624736
0
 
LVL 15

Author Closing Comment

by:StealthyDev
ID: 33624745
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
 
LVL 16

Expert Comment

by:Valeri
ID: 33624753
ops, soory! :-)
First of all get familiar with MANIFEST.MF file and you will fix this.
0
 
LVL 15

Author Comment

by:StealthyDev
ID: 33624763
@Veleri: How to specify multiple Main Class in MANIFEST.MF ?
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Support for Notepad++ (including downloading & installing a plugin) 5 162
MySQL  on Tomcat 8 68
jboss 7.1 start up error 1 40
Setup GlassFish 4 22
Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
This video teaches viewers about errors in exception handling.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question