Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / January 2006

Tip: Looking for answers? Try searching our database.

JAR file which needs to call another jar file....

Thread view: 
gooderthanyou@gmail.com - 29 Jan 2006 21:02 GMT
Ok... I'm using eclipse and I create a jar (with applet and all).  It
runs fine in eclipse but out on its own, it doesn't.  I simply am using
this html to open the jar..:

<HTML>
 <HEAD>
   <TITLE>Pinball</TITLE>
 </HEAD>
 <BODY>

<p>
 <APPLET code = "GUI.class" name="Pinball"
   width = "626" height = "501"
   archive = "PinballGame.jar" id="Pinball">
   Java is not installed get it now!
 </APPLET>
</p>
<p>Pinball created by Natalie, Curtis, Vincent, and Kevin</p>
<P><A HREF
="http://www.java.com/en/download/windows_automatic.jsp">Download JAVA
Virtual Machine Here</P>
 </BODY>
</HTML>

The only problem is I have physics.jar, it is included in the jar but
for some reason it won't access it, i've looked for the past 3 hours
trying to figure it out,

Thanks
James Westby - 29 Jan 2006 22:47 GMT
> Ok... I'm using eclipse and I create a jar (with applet and all).  It
> runs fine in eclipse but out on its own, it doesn't.  I simply am using
[quoted text clipped - 25 lines]
>
> Thanks

A jar cannot access a jar within itself. I'm not sure how it works in
applets, but in applications the second jar (physics.jar) needs to be
outside the first (PinballGame.jar), but on it's classpath.

James
Thomas Hawtin - 29 Jan 2006 23:00 GMT
> A jar cannot access a jar within itself. I'm not sure how it works in
> applets, but in applications the second jar (physics.jar) needs to be
> outside the first (PinballGame.jar), but on it's classpath.

You can open the jar inside as a resource, but you wouldn't be able to
load classes from it (as an applet).

Tom Hawtin
Signature

Unemployed English Java programmer
http://jroller.com/page/tackline/

James Westby - 30 Jan 2006 00:04 GMT
>> A jar cannot access a jar within itself. I'm not sure how it works in
>> applets, but in applications the second jar (physics.jar) needs to be
>> outside the first (PinballGame.jar), but on it's classpath.
>
> You can open the jar inside as a resource, but you wouldn't be able to
> load classes from it (as an applet).

Thanks for pointing this out. Could you clarify the comment "as an
applet" for me please? Do you Mean that an applet could not be created
from them, or that they cannot be loaded when you are operating as an
applet? If it is the latter then how is it possible as an application?
Does it require a different classloader to be used?

I ask because I have come across this situation before (with an
application) and I couldn't see a solution to the problem that I liked
anywhere, it would be good to know whether this is possible.

Thanks,

James
Thomas Hawtin - 30 Jan 2006 00:32 GMT
>> You can open the jar inside as a resource, but you wouldn't be able to
>> load classes from it (as an applet).
[quoted text clipped - 4 lines]
> applet? If it is the latter then how is it possible as an application?
> Does it require a different classloader to be used?

Yeah. Copy the data out of the resource and create a custom ClassLoader
that uses that data.

Applets cannot create class-loaders (unless they are signed). However,
they can read the data fine.

Tom Hawtin
Signature

Unemployed English Java programmer
http://jroller.com/page/tackline/

James Westby - 30 Jan 2006 10:07 GMT
>>> You can open the jar inside as a resource, but you wouldn't be able
>>> to load classes from it (as an applet).
[quoted text clipped - 12 lines]
>
> Tom Hawtin

Thanks,

James


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.