Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-26-2007, 05:48 PM
Member
 
Join Date: Nov 2007
Posts: 6
SteM is on a distinguished road
Calling jar classes from java executable
Hi all,
I have a java application in the form of exe file (Windows).
From this application i need to load an external jar and execute it.
Using methods Class.forName(), getMethod() amd invoke() I made some steps but I have some problems.
I'm able to instanciate the main class in the jar but when the code instances another class (in the jar) I receive a java.lang.NoSuchMethodError exception.

In general :
how can i load all the classes contained into the jar archive?
which classes defined in the second app i can invoke from the first one?
which classes defined in the first app i can invoke from the second one?
if I should have the same class in both app, what happens?

Thanks a lot !!
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 11-27-2007, 10:21 AM
Member
 
Join Date: Nov 2007
Posts: 18
sandeepkk2005 is on a distinguished road
If you want to invoke it as a separate application then use

Runtime.getRuntime.exec("java -jar yourJarFileName.jar");

if u want to use the functions(or methods) then put the jar file in classpath, import it & create the object and use the methods.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
convert a java binary/executable to a intermediate language sumit_400461 Advanced Java 1 07-13-2008 09:04 PM
Executable Java eva New To Java 3 12-31-2007 01:38 AM
Problem calling classes to flip coin x number of times and record heads or tails adlb1300 New To Java 2 11-11-2007 10:07 AM
Java Wrapper Classes JavaForums Java Blogs 0 08-04-2007 04:24 AM
Running java classes with XML ai_2007 Advanced Java 1 06-29-2007 05:20 PM


All times are GMT +3. The time now is 02:13 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org