Getting List of Available Drivers from jar Folder

I'm trying to build a very very basic DB admin software for personal use (and if it works I'll turn it into an opensource project for people smarter than me to play with)
And I'm stuck with this problem:
I want the software to load DB Drivers at runtime, from a JAR folder. The same way Eclipse loads it's plugins.
Something like this (folder structure)
MainApp.jar <-- executable
/drivers/mysql.jar
/drivers/oracle.jar
/drivers/etc.jar
When I run MainApp the program should load the list of jars and tell me "you can use: mysql, oracle, and ETC"
But I can't find anything on the matter. I need an instance of the driver to get the properties (name) of it and I need the JDBC url to get an instance of the driver...
Is there any way to achieve this by having just the path to the drivers folder ?
Thanks in advance for any answer.

Basic Steps
- Read files in the folder with the jar extension. There is a class somewhere that does this and returns a list of files.
- Open the jar. You will need to learn about the 'zip' package - look for it in the java API.
- Sequence through the contents of the jar looking for any classes that implement the JDBC API. The base is the Connection interface. this requires loading the classes.
Once you do that an enhancement is to use a class loader to load the files. That way you can unload when done.

Similar Messages

  • CUPS, HP PSC 2355 and "Unable to get list of printer drivers: Unknown"

    Hey fellow Archers!
    The Introduction
    The other day, I installed ArchLinux for the ARM processor on my GoFlex Home. Straight away I installed samba, got it set up and everything works like a charm with explosive transfer-rates compared to the old factory-firmware. Also put on a mysql server to centralize my xbmc database and pyload to download large files without having to have my laptop opened all the time. Have to admit, this Arch Linux is a glorious world!
    The Setup
    Well, after this positive input, now comes my problem. I wanted to share our printer on our LAN, so I did a little search to quickly find CUPS. Installed it together with all the dependencies, like foomatic, python (which was installed as pyload uses it) and all that stuff.
    Changed the /etc/cups/cupsd.conf to listen on 0.0.0.0 and started the daemon.. Woohoo! Turned on the printer, opened the web interface, went to administration -> add printer and selected one of the printers available from this list:
    Local printers
    CUPS-PDF (Virtual PDF Printer)
    HP PSC 2350 series USB MY5BNF4423KJ HPLIP (HP PSC 2350 series)
    Seriel port #1
    HP PSC 2350 series (HP PSC 2350 series)
    HP Fax (HPLIP)
    Before I proceed, I want to say that I have tried the following with both of the PSC-entries.
    The Problem
    Now, i selected the printer and just let the default values be, pressed continue and got this error message:
    "Unable to get list of printer drivers: Unknown"
    Well, googled it a bit and tried to blacklist lsusb, as well as chmod /dev/bus/usb/001/002 to 665 (even 777). Still the same error message. Also tried to install the printer with hp-setup -i which let me pick a ppd myself; didn't work either. Gave me an error message saying that it was unable to add the printer to cups. I have run out of options, and the almighty sir Google wont give me any solutions other than those which I have tried.
    I even get this error message when I try to add cups-pdf (which I also installed oc).
    Kind regards,
    Rasmus Dencker
    Last edited by dencker90 (2011-12-30 17:53:10)

    Hey fellow Archers!
    The Introduction
    The other day, I installed ArchLinux for the ARM processor on my GoFlex Home. Straight away I installed samba, got it set up and everything works like a charm with explosive transfer-rates compared to the old factory-firmware. Also put on a mysql server to centralize my xbmc database and pyload to download large files without having to have my laptop opened all the time. Have to admit, this Arch Linux is a glorious world!
    The Setup
    Well, after this positive input, now comes my problem. I wanted to share our printer on our LAN, so I did a little search to quickly find CUPS. Installed it together with all the dependencies, like foomatic, python (which was installed as pyload uses it) and all that stuff.
    Changed the /etc/cups/cupsd.conf to listen on 0.0.0.0 and started the daemon.. Woohoo! Turned on the printer, opened the web interface, went to administration -> add printer and selected one of the printers available from this list:
    Local printers
    CUPS-PDF (Virtual PDF Printer)
    HP PSC 2350 series USB MY5BNF4423KJ HPLIP (HP PSC 2350 series)
    Seriel port #1
    HP PSC 2350 series (HP PSC 2350 series)
    HP Fax (HPLIP)
    Before I proceed, I want to say that I have tried the following with both of the PSC-entries.
    The Problem
    Now, i selected the printer and just let the default values be, pressed continue and got this error message:
    "Unable to get list of printer drivers: Unknown"
    Well, googled it a bit and tried to blacklist lsusb, as well as chmod /dev/bus/usb/001/002 to 665 (even 777). Still the same error message. Also tried to install the printer with hp-setup -i which let me pick a ppd myself; didn't work either. Gave me an error message saying that it was unable to add the printer to cups. I have run out of options, and the almighty sir Google wont give me any solutions other than those which I have tried.
    I even get this error message when I try to add cups-pdf (which I also installed oc).
    Kind regards,
    Rasmus Dencker
    Last edited by dencker90 (2011-12-30 17:53:10)

  • How to get list of file names from a directory?

    How to get list of file names from a directory?
    Please help

    In addition, this:
    String filename = files;Should be this:
    String filename = files;
    That's just because he didn't use the "code" tags, so [ i ] made everything following it become italicized.                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to get list of selected files from swf to javascript ?

    Hi everybody,
    i want to make an upload script with swf and javascript. I want to do selecting files via swf then uploading files to server via javascript. I have searched SWFupload plugins but they are not working as i need. I am new here and i do some search, i see it is possible to save list of selected files in FileReferenceList array, but i dont know if is it possible to pass this array into javascript and then make upload progress via javascript ?

    Hi,
    You will not be able to get the local file paths from FileReference due to flash security restrictions.
    Hence I think it is not possible to pass the file reference data to javascript and load the same.
    Warm Regards
    Deepanjan Das
    http://deepanjandas.wordpress.com/

  • Get specific filenames and sizes from a folder based on a list of variables

    Hi,
    I have a folder containing user's OST files, with various filenames:
    \\myserver\OST share\JBLoggs - Outlook 2010.ost
    \\myserver\OST share\CKent - Outlook2013.ost
    \\myserver\OST share\BAllan Myoutlook.ost
    There are several thousand files, and I need to get the file names & file sizes for 200 specific users only. I tried a for do in a bat file, but wildcards don't appear to be honored:
    "for /f %%a in (C:\Temp\UserNames.txt) do dir "\\myserver\OST share\%%a*" >> C:\Temp\Filenames.txt
    The * is not recognised as a wildcard, and the .bat fails (the dir command is parsed as "\\myserver\OST share\JBloggs*)
    I can do this manually via Excel, but it will be an ongoing task so I'd rather automate it. I've also tried Powershell, but am hitting policy restrictions (from my employer, not from Powershell), and no joy with Google. Any advice? (& thanks to all for
    looking!)

    Edit: Adding a PushD/PopD to the start and end of the bat file and removing the path from the dir command appears to have fixed it.
    Must have been something in the folder path that was breaking it, although since it maps fine through PushD & works when typed manually, I'm at a loss to explain what. Thanks for taking a look - appreciated!
    I'm not sure why it's working for you, but not working for me - I had assumed there was a syntax error/rule/additional switch needed in a For Do loop, so that is what I have been researching. There are definitely confirmed files that start with the usernames
    in my list. As an example:
    -My list & folder contains the variable DQuinn. When I run the bat file the following is displayed in the command prompt window I run it from:
    C:\Windows\System32>dir "\\myserver\OST share\DQuinn*"  1>>C:\Temp\Filenames.txt
    So the wildcard is treated as a literal * character, and not as a wildcard - in turn the dir command fails.
    (I'm not sure why 1 is displayed in front of the >>, but the txt file is written to correctly and removing the whole >>C:\Temp\Filenames section doesn't fix the bat file, so I'm not worried about that part).
    -From the same command prompt, if I run the command
    dir "\\myserver\OST share\DQuinn*"
    Then I get the expected output:
    Directory of \\myserver\OST share
    01/04/2015  02:47 PM       250,322,944 [email protected] - 2010.ost
                   1 File(s)    250,322,944 bytes
                   0 Dir(s)  4,288,303,345,664 bytes free
    Side note: I'm assuming the double a (%%aa) in your answer is a typo? I tried copying it just in case, but no joy :)

  • To get list of suspended responses from database

    Hi All,
    we have O2A PIP installed with below versions:
    Oracle AIA     11.1.1.5
    Oracle WebLogic    10.3.5
    SOA Suite    11.1.1.5
    O2C PIP        11.1.1.1
    In Production some of the orders are failing because of Siebel internal error and hence those responses are also erroring out in AIA.
    Now as per the resequencing logic all subsequent responses for that account is going into suspended state so that only when the faulted response was recovered successfully, the subsequent response will flow.
    The issue we have here is, whenever any new order is coming bearing same Account no. for which the response of some order has failed, the responses of new orders are also going into suspended state. now all suspended responses we can only see that in mediator_instance table, one row is getting added with same group_id of that account. leaving us with no option to identify if this response is for new order or same order which has faulted.
    we can identify all the responses which has faulted by combining mediator_instance and composite_instance table as instance of updateSalesOrderSiebelComsProvABCSImpl gets created for the response which has failed.
    but we need the list of all new orders and its group_id which is going into suspended state because of some other order's faulted response.
    Please let us know if there is any way to get this list from database.
    Thanks & Regards,
    Vivek

    In addition, this:
    String filename = files;Should be this:
    String filename = files;
    That's just because he didn't use the "code" tags, so [ i ] made everything following it become italicized.                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Get Front Row to play from HVDVD_TS folder

    How can I get Front Row to play content from a HVDVD_TS folder. It works great with standard VIDEO_TS folders (under Leopard/Snow Leopard) but it doesn't seem to recognise my DVD Studio Pro generated HVDVD_TS folder.
    Thx!
    Cojcolds

    I have the same problem with remote control device (infrared) and FrontRow as many other users, see links below.
    And yes, I have tried all the described "remedies", but the problem is still there.
    The problem is that after boot, FrontRow reacts to the remote ok (about 10-15 minutes), but then
    FrontRow stops responding to remote control commands. However, FrontRow can be controlled by keyboard
    commands all the time. If iMac is now booted, the problem is still there. The only way I have had FrontRow
    and remote work ok (for 10-15 mins) is shutting down iMac, waiting an hour or so, and then booting it. I'm just
    wondering is this hardware problem (related to e.g. temperature ?), problem with FrontRow itself, or problem with
    related daemons. Anyway, I hope that this is sw problem, and Apple could fix quite soon in next FrontRow or Mac OS X
    update. Otherwise, I'm 100% sure to replace my iMac because of this stupid little bug (that seemed to be the only
    working remedy).
    - Kari
    http://discussions.apple.com/thread.jspa?messageID=1264312&#1264312
    http://discussions.apple.com/thread.jspa?threadID=287078&tstart=15
    http://discussions.apple.com/thread.jspa?messageID=1438431&#1438431
    http://discussions.apple.com/thread.jspa?threadID=309333&tstart=15
    http://discussions.apple.com/thread.jspa?messageID=1439228&#1439228
    http://discussions.apple.com/thread.jspa?messageID=1003149&#1003149
    http://discussions.apple.com/thread.jspa?messageID=1004692&#1004692
    http://discussions.apple.com/thread.jspa?messageID=1317018&#1317018
    IMAC G5/2.1GHz, 20" iSight   Mac OS X (10.4.3)   512MB, 250GB

  • List all JDBC drivers from a machine

    How to list all the JDBC drivers supported by Java through programing in Java.
    Thanks in advance

    Write a spider to look though all the links you can
    get to through [url
    http://servlet.java.sun.com/products/jdbc/drivers]this
    page, find the names of the drivers and add themto you list. There are probably some drivers which
    aren't listed there, but I bet a quick google through
    [url
    http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=
    ava+driver]these 1,910,000 pages should get you
    most of the rest.
    So would you suggest doing that once to build a static list or doing it dynamically each time? :)

  • How to correct list of available drivers

    Hi,
    Sorry if this has been answered- I sure couldn't find it.

    Hi Greg,
    "What exactly did you delete?"
    Drivers for all sorts of HP products I'll never buy, and a ton of others Iv'e since forgotten; Drivers (or at least their names) for Apple, OKI, and other printers I won't use persist in the drop-down list entitled "Print Using:...Select a Printer to Use"
    Many TIA
    Dave

  • How to get list of dates between from date to till date?

    for example:
    from date= 20071001(yyyy-mm-dd)
    till date =20071102(yyyy-mm-dd)
    i need to printout the date betwwen these two dates inclusive.?
    please suggest me to do this.....

    Use Data and Calendar objects, read the API - there is a method for adding values to a specified field of the date - what you need to do is simply loop and add one day to the start date and check wheather you've reached the end date.
    In the loop you can add the newly created date objects to a list or print them out directly.
    HTH

  • How is it possible to get list of VIs from executable?

    Hi!
    Simple question.
    I have executable (builded with LabVIEW, of course).
    In LabVIEW 8.0.1 - based application I able to get list of VI inside of executable (with ..\LabVIEW 8.x\vi.lib\Utility\libraryn.llb\Get VI Library.vi)
    But if application was builded with LabVIEW 8.2 it seems to be impossible, because error 13 occurred (file is not a resource file).
    How is it possible to get list of all VIs from executable which was generated with LabVIEW 8.2?
    I do not prefer to build application with llb.
    Theoretically I can "convert" exe to llb, and then get list of VIs, but this is "undocumented" way and not preferred.
    Any other (better) ideas how to do this?
    best regards,
    Andrey.

    Hi Andrey;
    Just happened to be browsing for a different problem, but an alternative method (assuming I understood the question correctly) may be to use the "List Folder" vi to create a list of all VIs contained within your .exe application.  From this list, you could further use a "Match Pattern" vi to do further sorting.
    For example, if any constructed VIs contained the phrase "SubVI" within the file name, use "Current VI Path" followed by a single "Strip Path" (to eliminate the active VI name), use a "List Folder" to extract the vi names contained within the .exe, and match pattern for something like "*SubVI.vi" to get a listing of all VIs with the phrase "SubVI.vi" in the file name.
    Hope it helps.
    DJH

  • How to get latest added file from a folder using apple script

    Hi..
    I am trying to get a latest added file from a folder..and for this i have below script
    tell application "Finder"
        set latestFile to item 1 of (sort (get files of (path to downloads folder)) by creation date) as alias
        set fileName to latestFile's name
    end tell
    By using this i am not able to get latest file because for some files the creation date is some older date so is there any way to get latest file based on "Date Added" column of a folder.

    If you don't mind using GUI Scripting (you must enable access for assistive devices in the Accessibility System Preference pane), the following script should give you a reference to the last item added to any folder. Admittedly not the most elegant solution, but it works, at least under OS X 10.8.2.
    set theFolder to choose folder
    tell application "Finder"
        activate
        set theFolderWindow to container window of theFolder
        set alreadyOpen to exists theFolderWindow
        tell theFolderWindow
            open
            set theInitialView to current view
            set current view to icon view
        end tell
    end tell
    tell application "System Events" to tell process "Finder"
        -- Arrange by None:
        set theInitialArrangement to name of menu item 1 of menu 1 of menu item "Arrange By" of menu 1 of menu bar item "View" of menu bar 1 whose value of attribute "AXMenuItemMarkChar" is "✓"
        keystroke "0" using {control down, command down}
        -- Sort by Date Added:
        set theInitialSortingOrder to name of menu item 1 of menu 1 of menu item "Sort By" of menu 1 of menu bar item "View" of menu bar 1 whose value of attribute "AXMenuItemMarkChar" is "✓"
        keystroke "4" using {control down, option down, command down}
        -- Get the name of the last item:
        set theItemName to name of image 1 of UI element 1 of last scroll area of splitter group 1 of (window 1 whose subrole is "AXStandardWindow")
        -- Restore the initial settings:
        click menu item theInitialSortingOrder of menu 1 of menu item "Sort By" of menu 1 of menu bar item "View" of menu bar 1
        click menu item theInitialArrangement of menu 1 of menu item "Arrange By" of menu 1 of menu bar item "View" of menu bar 1
    end tell
    tell application "Finder"
        set current view of theFolderWindow to theInitialView -- restore the initial view
        if not alreadyOpen then close theFolderWindow
        set theLastItem to item theItemName of theFolder
    end tell
    theLastItem
    Message was edited by: Pierre L.

  • Loading images from jar

    Found a good solution that works from running in command line, i.e java -jar or normally or using web start and not getting missing image URL loading from jar
    It deserves some dukes :) Also, someone can improve on it to make sure it's 100%
    Asume the function is in a package AWTUtilities class
    Many forums provide close solution but they all forget the vital replacing back slash with forward slash when reading from jar!! :)
    That's what got me stump for a good day trying to figure why it should load the images, but it's not...
    Regards
    Abraham Khalil
       // The subtlety in getResource() is that it uses the
       // Class loader of the class used to get the rousource.
       // This means that if you want to load a resource from
       // your JAR file, then you better use a class in the
       // JAR file.
       public static Image getImageResource( String name ) throws java.io.IOException {
          return getImageResource( AWTUtilities.class, name );
       public static Image getImageResource(Class base, String name ) throws java.io.IOException {
          if (name != null) {
             Image result = null;
             // A must, else won't pick the path properly within the jar!!
             // For file system forward or backward slash is not an issue
             name = name.replace('\\', '/');
             // For loading from file system using getResource via base class
             URL imageURL = base.getResource( name );
             // For loading from jar starting from root path using getResource via base class
             if (imageURL == null) {
                imageURL = base.getResource("/" + name );
             // For loading from file system using getSystemResource
             if (imageURL == null) {
                imageURL = ClassLoader.getSystemResource( name );
             // For loading from jar starting from root path using getSystemResource
             if (imageURL == null) {
                imageURL = ClassLoader.getSystemResource("/" + name );
             // Found the image url? If so, create the image and return it...
             if ( imageURL != null ) {
                Toolkit tk = Toolkit.getDefaultToolkit();
                result = tk.createImage( (ImageProducer) imageURL.getContent() );
             return result;
          else {
             return null;

    The problem is that you use the wrong classloader. The system default classloader is the one that launched the webstart utility. It doesn't contain your classes or jars. You have to get hold of the classloader for your classes.
    Here's my solution as a schetch: probably it won't compile but you get the idea:
    // 1: get hold of the classloader for my classes:
    // - this class cannot possibly be loaded by anyone else:
    Object dummy = new Object(){
    public String toString() { return super.toString(); }
    ClassLoader cl = dummy.getClass().getClassLoader();
    // 2: get an inputstream to read resource from from jar:
    InputStream is = cl.getResourceAsStream("images/myimage.gif");
    // 3: create image from inputstream
    // can be done in many different ways using tmp-files etc.
    ImageIcon icon = new ImageIcon(is);
    Image img = icon.getImage();

  • Getting a list of users and permission from a folder

    I run this command to get a a list of users and permission from a folder
    $project_folder = "\\servername\foldername"
    get-acl $project_folder | %{ $_.Access  } | ft -property IdentityReference, AccessControlType, FileSystemRights > folder.csv.
    This only lists information for 1 folder.
    If i have multiple folders how should the code be modified?

    this is the code i am looking for 
     $project_folder
    = "\\servername\foldername\foldername1"
    get-acl $project_folder | %{ $_.Access  } | ft -property IdentityReference, AccessControlType,
    FileSystemRights > folder.csv.
    I  run this code and this gives me the information for only the folder 'foldername1'.
    Ex. i need a list of users who have permmission in \\servername\foldername\foldername2.
    i run the code and it gives me the permissions and list of users in foldername2.
    This is the issue
    IF there are multiple folders \\servername\foldername\foldername2, \\servername\foldername\foldername1,
    i need to run the code each time for 1 folder. 
    is there a command where i can combine the path of these 2 or more folders and export
    it to csv
    Ex.  $project_folder
    = "\\servername\foldername\foldername1",
    "\\servername\foldername\foldername2"
    get-acl $project_folder | %{ $_.Access  } | ft -property IdentityReference, AccessControlType,
    FileSystemRights > folder.csv.
    This will give me the list of users and the type of access they have in foldername1 and
    foldername2

  • Get a list of files from a folder

    Hi I would like to know how could I get a list of files containing into a folder on my computer using javafx... can anyone help?
    Thank you very much!
    Daniel

    I'll try that... i just want to list all videos containing into a folder intro grid =)
    i thought that had a special way using javafx
    Thanks
    Edited by: skul3r on Dec 19, 2008 6:47 AM

Maybe you are looking for

  • Lost contacts and calendar, possibly MobileMe related

    My wife just lost all contacts and calendar from her iPhone 4. She had been bothered by repeated requests by the phone for her MobileMe password. As far as she knew, she was not a MobileMe user, so our son disabled the MobileMe account on the phone.

  • Not able to transport the BI Content(Dev) to Production.

    Hi Gurus, <h6>I'm transporting BI Admin Cockpit to prod and its ending with errors. I've successfully moved it to QA but while moving to Production it is ending with errors.</h6> <h5>I'm trying to push the below listed objects:</h5> <h6>0TCT_VC11    

  • Upgraded to 7.3.2.6, can't connect to store

    I can't connect to the iTunes store after upgrading to the latest version. Obviously I can connect to the internet or else I couldn't have posted this message. iTunes was working fine previously. Is the store just offline now or is there a new settin

  • Creating an html file in XI using an xsl stylesheet  -- two error types

    Hi I am working on mapping an xml invoice to an html-file using a stylesheet  (xsl-file)  in the message mapping in XI 3.0. Thus the inbound message is an xCBL Invoice and the output message is to be an html file. I name the output file "%supplierid%

  • Install Java JRE 1.4.2 plugin on Phoenix on Windows

    How can I install Java JRE 1.42 on Phoenix on Window 2000? In the Java Plugin-in control panel, it only has Mozilla 1.1 and if I click it, it said I don't have mozilla 1.1 install. Thank for your help.