Classes+resources in JAR: have to add each single Jar file to CLASSPATH?

Hello,
For my application, I plan to easily embed plugins that can be added by the user by copying it into a subfolder "plugins".
Now, I start my app from a shellscript and in order to load resources from within some of these Jars (e.g. using Class.getResourceAsStream() ), it only works if I explicitly add the specific Jar filename to the classpath from the shellscript.
I read in a German Java book, that also just using folder names is enough, but it does not work for me:
Works:
$JAVA_HOME/bin/java -Djava.library.path="./lib" -classpath "./lib:./plugins/test.jar" test.AppFails:
$JAVA_HOME/bin/java -Djava.library.path="./lib" -classpath "./lib:./plugins/" test.AppIs it really required to add Jars explicitly, so that e.g. my shellscript has to make a Jar listing of that folder in order to pass them as classpath files?
Thanks and regards,
Timo

No, you don't have to do it that way. What you need
to do is to have your progam create a URLClassLoader
pointing to all the jars in the plugin directory.
Then request your plugin classes from that, rather
than Class.forName();
You need to create an array of file URLs for the
jars, use File.listFiles() and then File.toURL() on
each ..jar you find.
p.s. If you do it this way make sure your plugin
classes are not on the classpath.
Hmm. Cool. I had no idea. Thanks for correcting me.

Similar Messages

  • When sending an email I used to be able to add a distribution list from my contacts, I now have to add each email address individually, does anyone know how I can add the whole list?

    When sending an email I used to be able to click on a distribution list in my contacts and it would add all the email addresses, I now have to add each email address individually and this takes a lot of time.  Could someone tell me how I can add a distibution list/group to my emails?

    Barney,
    I have four groups.
    I just typed the name of one of those groups in the To field on the iPhone's email, and received:
    Invalid Address
    "<group name>" does not appear to be a valid email address.  Do you want to send it anyway?
    I clicked continue and it remains in my outbox.
    Help is appreciated.
    Thanks,
    Michael

  • Is there a way to add a single jar to an existing shared library (war)?

    Hello,
    Is there a way to add a single jar to an existing and already deployed shared library (war) in weblogic directly?
    Basically, instead of building and deploying the war each time a new jar should be added to the list of jars present in the war and deploy it in weblogic, is it possible to make the process more automatic and efficient by just adding the new jar to the existing deployed war (no matter if the consumers must be reloaded)?

    Extract the WAR file and rearchive with theJAR file included.

  • Convert a catalog form PSE 7 to PSE 13 : Conversion works, but images are not related to the catalog anymore so you have to connect each single picture !!! How can I get the right relation automatically ?

    My images are not related to the converted catalog, only preview works, tags and other information is given, but the (network) path to the original images is missing and is substituted by a local path with c:\. How can I solve the problem automatically ?

    I actually need to apply this to at least a couple different layouts. Two exampled below (The outlined boxes are text areas, the black boxes where the product images will go.)
    I prefer InDesign5, but I have 6 too.

  • HT4007 I reinstalled Aperture 3. Do I have to install every single update files or only the latest one?

    Hi All.
    I just reinstalled Aperture 3.
    I'm just wondering do I have to install every update files by in order? or do I just need to install the latest one?
    Please let me know.
    Thank you.

    Just run Software Update (or from the App Store) and let Apple do the rest.  It should bring you completely up-to-date.

  • Adding Classes to the JAR File's Classpath

    Ques 1- Can I use the wildcard * symbol in Manifest file to add classes/othes jar files to the JAR File's Classpath.I have folder named - Lib . where there are many jar files.Now,do I have to add each jar file by- Class-Path: Lib/jar1-name Lib/jar2-name . Instead, can I do this- Class-Path: Lib/*.jar OR Class-Path: Lib/*.class
    RIDICULOUS....105 views has been made but YET NO ANSWER. Isn't there anybody who knows the answer.
    Edited by: Tanvir007 on Apr 30, 2008 2:21 AM

    Ques 1- Can I use the wildcard * symbol in Manifest file to add ... other jar files ...?No. You could, however, place all your needed JARs in JavaHome/jre1.x.x/lib/ext - if this is a way for you.
    Ques 2 ??
    RIDICULOUS....105 views has been made but YET NO ANSWER.What hindered you to test it yourself?
    And the things we don't know far exceed the things we know. Why do you wonder?
    Have a nice day
    J�rg

  • Does anyone know how to send an email to a "Group" on a device that has been updated to iOS-6, without having to individually add each recipient?

    Pre-update, you used to be able to send an email to one of your predefined "Groups" by merely typing the "Group" name into the address field.  Post-update, this no longer appears to work.  Post update, typing the "Group" name into the address field gets you absolutely nothing.  Now I seem to have to add each individual recipient into the address field, something I thought developing predefined "Groups" would save me from having to do each and every time.  Does anyone know of any viable solutions for this?

    You have to add each one, 1 at a time using the + button.

  • When adding audio to my webpage do I have to add a photo as well?

    Hello,
    I just set up my website using iweb and it was really fun and easy. I added an audio file to one of my pages and it required me to add a photo or it wouldn't add the song.
    Can this be changed?
    Thanks, Chad
    Powerbook G4 1.5   Mac OS X (10.4.2)  

    A clip from the help file:
    To add audio:
    In the site organizer, select the webpage you want to add the audio to.
    Do one of the following:
    To add a single audio file, drag it to the image placeholder on a webpage or to the webpage canvas. If you drag the audio file to the image placeholder on a blog (the Blog or Podcast template), iWeb creates a podcast. (See the podcast topics below.)
    To add more than one audio file, drag them to the webpage canvas. (Select more than one file at a time by Command-clicking.)
    To add links to the songs in the iTunes Music Store (not the audio files themselves), drag a playlist (from the Media Browser or iTunes) or a song from the iTunes Music Store to the webpage canvas.
    If you added audio files (not links), you can drag a graphics file to the placeholder above each song's audio controls. Or you can create a text box with a solid color fill to put over the placeholder. You can resize the graphic and the audio controls by dragging the handles.

  • Add Bookmark in PDF File

    Hi,
    I have to add bookmark in pdf file, i tried so many ways. But no use.
    i have a PDf with full text information, i want to add few text (Some words with in the PDF) from the content and need to add them in bookmark. i know i can add manulay but my pdf has 1000 to 2000 pages. so manual process is not easy. Is it any possible way to do in java?
    if we need i can get all the word in separate file too. can i read the word from another file and can i add them as a bookmark?
    for example, conside the below text which is available in my PDF. from this i want to add few word which is available in BOLD letters.
    Delta Enterprises said it would contact the customers who bought 600,000 of these cribs to send them additional parts to make the mechanism safer.
    +The other 985,000 cribs under recall, made in Indonesia and Taiwan, use safety pegs in the gate mechanism that customers must install.+
    +The recall is one of the largest in US history and follows another recall of 2,000 cribs, also made in China, which was issued by the CPSC on Thursday. A five-month-old infant suffocated after being trapped between the mattress and the crib side and prompted the recall Playkids USA cribs.+
    hope i explained clearly.
    Please help me.. im struggling lot...
    Thanks in advance.

    It is, but only if you do it using a script, not through the built-in "Open a web link"-action. Add a "Run a JavaScript"-action with this code:
    app.launchURL("http://www.google.com", true);
    Of course, you can change the URL to whatever you want.

  • Widget to add ".jpg" extension to files?

    I've imported hundreds of photos into Ilife6 just fine. Turns out they do NOT have the .jpg extension, so when I click to edit (and it calls Photoshop elements), Photoshop won't open the file -- it doesn't recognize it.
    Even though I photo sees it as a valid jpg file
    1) is there a way to tell Photoshop to open it anyway?
    2) is there a widget that I can point at a directory and have it add ".jpg" to all files. Then I can reimport them into iphoto.
    Thanks,

    Hello G5 in PA,
    You can try using Renamer4Mac.
    HTH
    Jeff
    Mini 1.25, 512 AP/BT; 12 Al PB 1.5, 512 AP/BT   Mac OS X (10.3.8)   Wireless KB/Mouse, AEBS, 80 GB OWC FW HD

  • The KitKat upgrade has been a disaster. home wireless is no longer recognized, even going through the set-up process.  It does not connect to the car through Bluetooth seamlessly--I have to add my phone as a new device each time I get in the car.  In atte

    My home wireless is no longer recognized, even going through the set-up process.  It does not connect to the car through Bluetooth seamlessly--I have to add my phone as a new device each time I get in the car.  In attempting to solve these problems I have gone to settings-phone-upgrade and it states that the upgrade is available-select to continue-(which I do)- it checks -please wait and it then states that update not available - try later.

    Maybe not too late to help you.
    For specifically fixing the Bluetooth, un-pair your phone with the car, and go through the process of repairing the two.
    In general, the KK update requires many of us (different phones) to perform a Factory Data Reset after we back up our personal content (pictures, music, movies, or other downloaded files) to a PC or MAC. This will result in you having to do a bit of work to setup icons for the programs you use, and maybe putting in the specifics again for email accounts and other specialized apps. So if you are going to do this sort of thing... copy important information/settings down on paper.
    HTH.

  • Why do I have to click each time in the "TO" bar to add an additional email address? Before 4.0, I could keep typing and adding more addresses.

    When typing people to send my email to, I have ALWAYS been able to start typing and the address pops up, so I select it, then I can start another, and so on. NOW I can only start typing and select ONE email. The cursor is no where to be found and I can only add more email addresses by clicking EACH time in the address bar. HATE THIS!!!!

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    * Don't make any changes on the Safe mode start window.
    * https://support.mozilla.com/kb/Safe+Mode
    If it does work in Safe-mode then disable all extensions and then try to find which is causing it by enabling one at a time until the problem reappears.
    * Use "Disable all add-ons" on the [[Safe mode]] start window to disable all extensions.
    * Close and restart Firefox after each change via "File > Exit" (Mac: "Firefox > Quit"; Linux: "File > Quit")
    In Firefox 4+ you can use one of these to start in <u>[[Safe mode]]</u>:
    * Help > Restart with Add-ons Disabled
    * Hold down the Shift key while double clicking the Firefox desktop shortcut (Windows)
    * https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

  • [svn] 2597: Bug: BLZ-217 - Should add a resources/ lib directory to BlazeDS turnkey with messaging jars

    Revision: 2597
    Author: [email protected]
    Date: 2008-07-23 12:40:08 -0700 (Wed, 23 Jul 2008)
    Log Message:
    Bug: BLZ-217 - Should add a resources/lib directory to BlazeDS turnkey with messaging jars
    QA: Yes
    Ticket Links:
    http://bugs.adobe.com/jira/browse/BLZ-217
    Modified Paths:
    blazeds/branches/3.0.x/build.xml

    Hi,
    Can you mention the eclipse version you are using? And the platform in which you are trying to build?
    I feel its always better to be platform specific when you go in for headless build. I can see that the configs value in your properties file is "configs=*,*,*". Try changing it to appropriate value and build your product. For example, I use "configs=win32, win32, x86" for building my product in 32-bit windows machine.

  • Can i have two main in a jar

    I have an application with two differents programs, so i have two main in one jar.
    My manifest file :
    Manifest-Version: 1.0
    Main-Class: Interface.Interface_Lancement
    is it possible to launch my other main() from Interface.Interface_Lancement2 class or must i have another .jar with this manifest file :
    Manifest-Version: 1.0
    Main-Class: Interface.Interface_Lancement2
    I would only have on .jar but switch between two different main.
    Thx a lot.

    Maybe I'm missing something, but how's the jar file supposed to know which main you want to run? I would think instead, you may want to have one main that queries the user for which app they want to run, and then run the appropriate app, or have two jar, one for each app. If they share a lot of code, you could have three jars (app1.ja, app2.jar, and shared.jar) and add shared.jar to both their classpathes.
    hth,
    m

  • Give me a convenient method to add an external jar file to JRE.

    At past, when i use some external frameworks like struts,servlet, i should set the classpath as:
    .;C:\jdk1.5.0\lib\tools.jar;C:\jdk1.5.0\lib\xercesImpl.jar;C:\ApacheGroup\Tomcat 5.5\common\lib\servlet-api.jar;C:\ApacheGroup\Tomcat 5.5\common\lib\struts.jar;C:\classes\;C:\ApacheGroup\Tomcat 5.5\webapps\struts-blank\WEB-INF\classes\
    when i want to use an exeternal framework, i must add the %INSTALL_PATH%\someframeworkname.jar to the classpath.
    But i feel that is inconvenient for me, for example,I want to use jaxp,jaxr,jaxm,jaxrpc,saaj, I must add each of the jar file to the classpath.
    I think that must be a convenient method to do that?
    Can u give me a method?

    hi
    As I think u have to follow this step to use external jar in jre.
    1. Find installed jre path in one variable
    2. At Installation time add jar file to lib
    U can get jre path using System property

Maybe you are looking for

  • Problem logging on to the managed RAS using JBoss Seam

    <p>The app I am currently working on is using JBoss Seam.  The sample jsp files you guys created were excellent.  As a simple test I first tried to logon and export a report thru a different app using JSP and Tomcat and had no problems.   I then copi

  • RFC_ERROR while calling RFC FM from XI

    Hi Guys,               I am getting following error in the XI Monitor <rfc:ZFIBAPI_ACC_DOCUMENT_POST.Exception xmlns:rfc="urn:sap-com:document:sap:rfc:functions"><Name>RFC_ERROR_SYSTEM_FAILURE</Name><Text>Type conflict when calling a function module.

  • My I-touch wont connect to the internet.HELP

    OK i just got and ipod touch for my birthday and whenever i try to go on safari or youtube it says cannot connect to server. I am standing right in front of my wireless router. If i go to Wi-fi setting on my i touch it has the IP address and the Subn

  • Printing with black ink only

    I have a HP photosmart c6280.  I only want to print in black only but my colored ink keeps expiring and needs to be replace too frequently.  I have tried grayscale but it still drains my color ink.  what can be done about this?????

  • Aperture 3.0.2 image export takes a huge time

    Hi everyone! Yesterday I postprocessed 12 RAWs of portraits from 5D mk2 using similar techniques for each photo: - exposure +20 - brightness +7 - vibrancy +10 - levels on eyes - skin retouching/cloning ~150-250 brush strokes - skin smoothing tool - e