Link to home
Start Free TrialLog in
Avatar of Sasha_Mapa
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?
Avatar of dmaguillo
dmaguillo

A. Making your .jar file:
     jar cvf myjar.jar com/telmap/mapapplet/*.class

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:\com\jars\myjar.jar

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... :)
Avatar of Sasha_Mapa

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>
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>
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.MyApplet.class ARCHIVE = MyJarredApplet.jar>
</APPLET>


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
Avatar of ori_b
ori_b

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ok, I'll try this today, if it works, I'll give you the points.
It worked! Sorry for the delay, had to do other things before :-)