Solved

Libraries and jar files.

Posted on 2000-03-08
9
419 Views
Last Modified: 2013-11-23
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?
0
Comment
Question by:Sasha_Mapa
  • 5
  • 3
9 Comments
 
LVL 1

Expert Comment

by:dmaguillo
ID: 2596395
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... :)
0
 
LVL 7

Author Comment

by:Sasha_Mapa
ID: 2597101
Mine is an applet -- What exactly do I type in  the HTML tag?
0
 

Expert Comment

by:ori_b
ID: 2600299
Your HTML tag should look like this :
<APPLET CODE = classname.class ARCHIVE = myjar.jar>
</APPLET>
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 7

Author Comment

by:Sasha_Mapa
ID: 2600350
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>
0
 

Expert Comment

by:ori_b
ID: 2600385
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>


0
 
LVL 7

Author Comment

by:Sasha_Mapa
ID: 2600415
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.
0
 

Accepted Solution

by:
ori_b earned 10 total points
ID: 2600449
Sorry, I didn't understand this before,
what you can try is this :

<APPLET CODE = MyApplet.class ARCHIVE = "MyJarredApplet.jar , MyLibrary.jar">
</APPLET>

assuming MyLibrary.jar is the
com.telmap.mapapplet library jar file
0
 
LVL 7

Author Comment

by:Sasha_Mapa
ID: 2600569
Ok, I'll try this today, if it works, I'll give you the points.
0
 
LVL 7

Author Comment

by:Sasha_Mapa
ID: 2620548
It worked! Sorry for the delay, had to do other things before :-)
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
custom annotations 9 42
ejb entity bean example 2 7
Eclipse Java import and method not resolved 4 43
Setup GlassFish 4 21
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
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 “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

765 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