Solved

Java Help - JAR File

Posted on 2010-09-08
8
823 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
Comment Utility
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
Comment Utility
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
Comment Utility
0
 
LVL 15

Author Comment

by:StealthyDev
Comment Utility
Can you please send the content of batch file?

I normally use:
java -jar jarname.jar
0
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 16

Assisted Solution

by:Valeri
Valeri earned 50 total points
Comment Utility
0
 
LVL 15

Author Closing Comment

by:StealthyDev
Comment Utility
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
Comment Utility
ops, soory! :-)
First of all get familiar with MANIFEST.MF file and you will fix this.
0
 
LVL 15

Author Comment

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

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
mergeTwo  challenge 13 71
Configure a Local PHP Interpreter for Phpstorm 2 110
wordlen challenge 3 46
Starting to learn JAVA, 7 47
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This video teaches viewers about errors in exception handling.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now