-----Original Message-----
From: Aur�lien Mazurie <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Date: Mon, 27 May 2002 14:18:31 +0200
Subject: Re: Jar et classes externes
Oups ! J'ai dit n'importe quoi =)
J'ai oubli� une petite pr�cision: la classe que je souhaite appeller est
elle-m�me dans un fichier jar. Je voulais donc savoir si l'on pouvais
appeller une classe d'un fichier jar � partir... de la classe principale
du fichier jar qui englobe ce fichier jar (ouf !).
Eventuellement je peut extraire les fichiers du jar dont je souhaite
utiliser la classe et les placer dans le r�pertoire principal, plut�t
que de l'inclure, mais je voulais savoir s'il existait une solution plus
"propre".
----------------
Jette un oeil au m�canisme d'Extension du JDK, il y a tout ce qu'il te faut dedans
(faire appel � un .jar depuis un autre .jar):
http://java.sun.com/j2se/1.4/docs/guide/jar/index.html
en particulier:
An application (or, more generally, JAR file) specifies the relative URLs of the
optional packages (and libraries) that it needs via the manifest attribute Class-Path.
This attribute lists the URLs to search for implementations of optional packages (or
other libraries) if they cannot be found as optional packages installed on the host
Java virtual machine*. These relative URLs may include JAR files and directories for
any libraries or resources needed by the application or optional package. Relative
URLs not ending with '/' are assumed to refer to JAR files. For example,
Class-Path: servlet.jar infobus.jar acme/beans.jar images/
Multiple Class-Path headers may be specified, and are combined sequentially.
Currently, the URLs must be relative to the code base of the JAR file for security
reasons. Thus, remote optional packages will originate from the same code base as the
application. A future enhancement will leverage the facilities of the Java 2
Platform's Security APIs to allow references to JAR files at other URLs.
Each relative URL is resolved against the code base that the containing application or
optional package was loaded from. If the resulting URL is invalid or refers to a
resource that cannot be found then it is ignored.
--------------
Hope this helps,
Patrice
-- Use Opera, the most user-friendly web browser on Earth --