Sasha_Mapa
asked on
Libraries and jar files.
I have written a library. It is in a com/telmap/mapapplet directory.
A. How do I put all the class files in a jar file so that I can use the library from within the jar file?
B. Where do I place the jar file relatively to the code that wants to use it?
A. How do I put all the class files in a jar file so that I can use the library from within the jar file?
B. Where do I place the jar file relatively to the code that wants to use it?
ASKER
Mine is an applet -- What exactly do I type in the HTML tag?
Your HTML tag should look like this :
<APPLET CODE = classname.class ARCHIVE = myjar.jar>
</APPLET>
<APPLET CODE = classname.class ARCHIVE = myjar.jar>
</APPLET>
ASKER
But I already have the whole applet in a jar file, so my HTML tag already looks like:
<APPLET CODE = MyApplet.class ARCHIVE = MyJarredApplet.jar>
</APPLET>
<APPLET CODE = MyApplet.class ARCHIVE = MyJarredApplet.jar>
</APPLET>
where is MyApplet.class located in the jar ?
if it is in com/telmap/mapapplet/ then
you tag should change to:
<APPLET CODE = com.telmap.mapapplet.MyApp let.class ARCHIVE = MyJarredApplet.jar>
</APPLET>
if it is in com/telmap/mapapplet/ then
you tag should change to:
<APPLET CODE = com.telmap.mapapplet.MyApp
</APPLET>
ASKER
No, I want to have 2 jar files, one with the applet, and another one with the com.telmap.mapapplet library. I want to run the applet, which would use the library.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok, I'll try this today, if it works, I'll give you the points.
ASKER
It worked! Sorry for the delay, had to do other things before :-)
jar cvf myjar.jar com/telmap/mapapplet/*.cla
B. You can put your .jar file where you want. Only must refer it in a CLASSPATH. For example, if "myjar.jar" is located in C:\com\jars:
CLASSPATH=%CLASSPATH%;c:\c
Is it´s an applet, you can refer it through tag ARCHIVE in the .html. With CLASSPATH runs too.
Another posibility with main programs will be:
java -jar myjar.jar
Bye... :)