?
Solved

execute a method which belong to jar file (a.jar) from another jar file (b.jar)

Posted on 2005-04-11
15
Medium Priority
?
240 Views
Last Modified: 2011-10-03
hi, i have a .jar file with a GUI (for example : ControlPanel.jar). i want to execute some other .jar files and some of their methods in ControlPanel.jar file.
for example : there is a icon on the ControlPanel.jar program's GUI. start a jar file (for example : game.jar) when i click the icon. after that there is a buton on ControlPanel.jar program's GUI, and when i clicked that buton, a method which is belong to a class of game.jar file have to execute.
and i sholud be able to control different .jar files from ControlPanel.jar file. i mean i should be able to add and remove .jar files from ControlPanel.jar.

how can i do that ?
0
Comment
Question by:elmakarge
  • 5
  • 4
  • 2
  • +1
12 Comments
 
LVL 35

Accepted Solution

by:
TimYates earned 256 total points
ID: 13751521
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 248 total points
ID: 13751530
You just need to ensure called.jar is in the classpath of caller.jar
0
 
LVL 35

Expert Comment

by:TimYates
ID: 13751541
>>  You just need to ensure called.jar is in the classpath of caller.jar

He said, that "...i should be able to add and remove .jar files from ControlPanel.jar...." so I guess this isn't feasible...

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 86

Expert Comment

by:CEHJ
ID: 13751568
Well it would be if you placed any potential callees in the classpath
0
 
LVL 35

Expert Comment

by:TimYates
ID: 13751573
Spose so...

A dynamic "hot-deployable" class loader would be sexier though (in a purely code based way) ;-)

(but much more work of course)

Tim
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 13751578
Yep
0
 
LVL 92

Assisted Solution

by:objects
objects earned 248 total points
ID: 13757547
0
 
LVL 92

Expert Comment

by:objects
ID: 13757552
> You just need to ensure called.jar is in the classpath of caller.jar

No you don't.

http://www.javaalmanac.com/egs/java.lang/LoadClass.html
0
 
LVL 13

Assisted Solution

by:Webstorm
Webstorm earned 248 total points
ID: 13760438
Hi elmakarge,

Related question about loading classes from jar files in a jar file :
http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_21381857.html

and the link which shoudl help you :
http://www-106.ibm.com/developerworks/java/library/j-onejar/
0
 
LVL 35

Expert Comment

by:TimYates
ID: 13760482
I don't think that's what he wants...  He wants something like a "plugin" folder where he can drop jar files that get added to/removed from his classpath automatically...

I think...
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 13760693
>>No you don't.

?? Why not?
0
 
LVL 35

Expert Comment

by:TimYates
ID: 14586799
This question is answered as far as I can see, so I reckon some form of split should be applied...

Shame elmakarge didn't return after asking it... :-(
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses
Course of the Month13 days, 8 hours left to enroll

749 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