Path Problem: Can't Load Database Settings From  A File

<b>I am writing a swing application with the following functionality:</b><br>
(1) There is a base class that supports things like changing the look and feel &ndash; this is done via a JDialog that loads all the installed lafs from which the user selects a choice.<br>
(2) Enables the user to set/change the physical database properties &ndash; location, password usernames and the like. -<br>
The idea is that when the application starts up for the first time the user will be asked to provide the database settings and then they will be stored in a file and then every time the application starts the settings will be loaded from this file. This works out fine!!!!!!!!!<br>
<br>
<b>Now here is the problem:</b><br>
All the above is supported by an abstract class that extends JFrame (I&rsquo;ve put abstract after testing) - MySuperFrame. After testing, I packaged this class together with other utility classes into a jar file.<br>
So my application which inherits from MySuperFrame fails on start-up with an exception that the database settings file cannot be found &ndash; And I know that it is in the jar file.<br>
+<br>
I think that my problem is the path and nothing but the path &ndash; or relative path.+<br>
<br>
This is the structure of my project:<br>
There is the src and the bin directories and then there is an external folder (not a package inside these two folders) called files (this is where my database settings file is stored).<br>
How do I solve this problem?<br>
How do I make sure my application loads the settings file regardless of where it is? I thought of passing the database settings file to a constructor of a database settings dialog class. But I don&rsquo;t know how to sort out the path issue.<br>
<br>
Please give me advice on how to implement that?

Apologies for the bad formatting on the original posting. Here is the formmatted posting:
Hi All,
I am writing a swing application with the following functionality:
(1) There is a base class that supports things like changing the look and feel &ndash; this is done via a JDialog that loads all the installed lafs from which the user selects a choice.
(2) Enables the user to set/change the physical database properties &ndash; location, password usernames and the like. -
The idea is that when the application starts up for the first time the user will be asked to provide the database settings and then they will be stored in a file and then every time the application starts the settings will be loaded from this file. This works out fine!!!!!!!!!
Now here is the problem:
All the above is supported by an abstract class that extends JFrame (I&rsquo;ve put abstract after testing) - MySuperFrame. After testing, I packaged this class together with other utility classes into a jar file.
So my application which inherits from MySuperFrame fails on start-up with an exception that the database settings file cannot be found &ndash; And I know that it is in the jar file.
+
I think that my problem is the path and nothing but the path &ndash; or relative path.+
This is the structure of my project:
There is the src and the bin directories and then there is an external folder (not a package inside these two folders) called files (this is where my database settings file is stored).
How do I solve this problem?
How do I make sure my application loads the settings file regardless of where it is? I thought of passing the database settings file to a constructor of a database settings dialog class.*{color:#ff0000} But I don&rsquo;t know how to sort out the path issue.{color}*
Please give me advice on how to implement that?

Similar Messages

  • Can't load Network Settings from System Preferences

    For some reason I can't load Network Settings from System Preferences anymore - it just stalls with the bar showing "Loading Network" and doing nothing. This is happening in conjunction with a new inability to connect to a network printer - it won't show up on the list of printers, even when I manually enter the IP address. Something is obviously mucked up - can anyone tell me what it might be & how I can fix it? Thanks!

    I was able to fix this myself by using one of the techniques suggested here for a different problem. Basically I went into Library/Preferences/System Configuration and deleted networkinterfaces.plist, preferences.plist & com.apple.nat.plist. All were rebuilt when I restarted and went to System Preferences/Network and I was able to load the Network Settings. This didn't fix the problem with my printer, but at least it got the settings up.

  • Can't load dimension properties from csv file

    Hi all, I work with EPM 11.1.1
    I'm trying to load DataStorage dimension property to existed Generic dimension (SKU) of my planning application.
    When I create a profile I can't see this property in the Mapping options window using the following file:
    !Section=Dimensions
    'Name;DimensionClass;DimensionAlias;CustomDimensionID
    SKU;Generic;;
    !Members=SKU
    'Name
    Brand1
    Brand2
    !PropertyArray=SKU
    'Property;Name;Value
    DataStorage;Brand1;StoreData
    DataStorage;Brand1;StoreData
    When I use the following file:
    !Section=Dimensions
    'Name;DimensionClass;DimensionAlias;CustomDimensionID
    SKU;Generic;;
    !Hierarchies=SKU
    'Parent;Child
    #root;Brand1
    #root;Brand2
    !Members=SKU
    'Name;DataStorage
    Brand1;StoreData
    Brand2;StoreData
    I get the following warning:
    Import Dimension SKU member section maps to non-dimension global property DataStorage. Data for this column will not be processed.
    What I do wrong?
    Edited by: Vovanenok on Apr 15, 2009 6:48 AM

    Try:
    !Section=Dimensions
    'Name;DimensionClass;DimensionAlias;CustomDimensionID
    SKU;Generic;;
    !Members=SKU
    'Name;DataType
    Brand1;Unspecified
    Brand2;Unspecified
    !Hierarchies=SKU
    'Parent;Child;DataStorage
    #root;Brand1;StoreData
    #root;Brand2;StoreData
    Tho I would add MemberValidForPlan#;Plan#Aggregation, where # is a number of your application which this member is valid for or even has a specific aggregation, as well
    example:
    !Hierarchies=SKU
    'Parent;Child;DataStorage;MemberValidForPlan1;MemberValidForPlan2;MemberValidForPlan3;Plan1Aggregation;Plan2Aggregation;Plan3Aggregation;UDA
    #root;Brand1;StoreData;Y;Y;Y;+;+;+;
    #root;Brand2;StoreData;Y;Y;Y;+;+;+;
    Even more as an idea use pipes, maybe.
    But you will need to say something about Aliases as well if this is a planning application.

  • How to load some text from properties file ?

    Hi again,
    problem is i dont know how can i load a text from properties file like #{xxx['key']} in managed bean, i tried to find some solution but havent seen this kind of use this file in java code. Is it supposed to work only for labels in jspx pages ?
    thanks for help ...

    Hi,
    a managed bean is nothing special from any other Java file. However, if you look at SRDemo, you find a nice way of using the same message bundle that you use on the page
    See the messageFromBundle() method in the JSFUtils class of the UserInterface project
    Frank
    P.s. You can download and setup SRDemo from JDeveloper help--> check for updates

  • My problem is a sudden loss of ability to get to PSE12 Organizer when I tried to load a saved scan. Had been using the Organizer and the Editor with no problems for several hours just before that.     Can not load the Organizer from the icon at the bottom

    My problem is a sudden loss of ability to get to PSE12 Organizer when I tried to load a saved scan. Had been using the Organizer and the Editor with no problems for several hours just before that.  
    Can not load the Organizer from the icon at the bottom of  Editor screen, from the icon on the MacBook Air dock (OS 10.10.2),  nor from the file in applications located with Finder.
    I have tried without success to access Organizer after turning off and on the scanner, turning off and on the computer, loading a fresh copy of PSE12 from the CD, and restoring default preferences.  I have searched on line for other options but not  found any. 
    Can you help me?

    Not Charge
    - See:    
    iPod touch: Hardware troubleshooting
    iPhone and iPod touch: Charging the battery
    - Try another cable. The cable for 5G iPod (lightning connector) seems to be more prone to failure than the older cable.
    - If a 5G iPod               
    Iphone 5 lightning port charging problem - SOLUTION!
    - Try another charging source
    - Inspect the dock connector on the iPod for bent or missing contacts, foreign material, corroded contacts, broken, missing or cracked plastic.
    - Make an appointment at the Genius Bar of an Apple store.
      Apple Retail Store - Genius Bar

  • Problem in getting the database connection from a connection pool

    Hai All,
    I am facing a problem in getting the database connection from a connection pool created on weblogic server 8.1.
    I am using the Oracle database 8.1.7.
    I have configured my connection pool, datasource and JNDI in weblogic.
    In my java program i have the following code to retrieve the connection.
    import java.sql.*;    
    import java.util.Hashtable;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    class jdbcshp1 {
        public static void main(String[] args) {
         Connection connection = null;
         try {
               Hashtable ht = new Hashtable();
               ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");  // Wanna get rid of this.
               ht.put(Context.PROVIDER_URL,"t3://localhost:7001"); // wanna get rid of this.
               // Get a context for the JNDI look up
               Context ctx = new InitialContext(ht);
            javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup ("myjndi1");
              //Create a connection object
              connection = ds.getConnection();
         The above code is working fine but, the two ht.put statements are creating problem.
    The problem is, after converting the application into WAR file it can be deployed
    on any machine or different port on same machine. My application fails if its deployed on
    weglogicserver which is at different port.
    Is there any way that i can get rid of those ht.put statements or any other way to solve the problem.
    any help is appreciated.
    Thanks in advance
    Pooja.

    Hai All,
    Firstly, thanks for ur reply.
    Even i have seen some code which uses context constructor with out any parameter and works fine.
    i dont understand why its not working for my code.
    When i remove those ht.put code and use context constructor with out any parameter, it giving an error.
    Context ctx = new InitialContext();
    javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup ("ocjndi");
    connection = ds.getConnection();The error is as follows:
    javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
    the above error is forcing me to include those code but if the port number is changed the code will not work. Plz let meknow if some setting have to be made.
    I appreciate all ur valuable help.
    Thanks once again.
    Pooja.

  • Migration Asstt - how to transfer database + settings from old MBA to MBP?

    Hi all,
    I just bought a new MacBook Pro and would like to transfer all my database + settings from the old MBA.
    I used Migration Assistant and transferred all the database alright, but the settings were not.
    I can see the folders like "Applications", "Movies", "Musics", etc under the new username, but I am not allowed to open them up.
    What do I do to also transfer the settings & applications that I had in the old MBA to the new MBP?
    What about items like Address Book & Calendar?
    Thank you!

    Welcome to Apple Discussions!
    Here's a link that might be helpful:
    http://discussions.apple.com/thread.jspa?threadID=435350&tstart=0
    Good luck!

  • SQL Server 2012 Developer Edition will not install. Setup files don't even get copied completely. Win 8.1. ACT instance is loaded & can't be deleted. From log file: Error: Action "PreMsiTimingConfigAction" failed during execution.

    SQL Server 2012 Developer Edition will not install.  Setup files don't even get copied completely.  Win 8.1.  ACT instance is loaded & can't be deleted. From log file: Error: Action "PreMsiTimingConfigAction" failed during execution.

    Hello,
    I am glad it worked.
    Thank you for visiting MSDN forums!
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • How can i load a VI from LABVIEW ver 6.0.1b3 to LABVIEW ver 6.1

    How can i load a VI from LABVIEW ver 6.0.1b3 to LABVIEW ver 6.1......I want to load a vi but i'm getting this error:
    LabVIEW load error code 9:VI version (6.1) is newer than LabVIEW version (6.0.1b3)
    My LabVIEW ver is 6.1
    Please help ......it's important
    Thanks

    I am having similar issues with a *.exe from LV6.1.  I have the runtime engine for 6.1 and recently upgraded to 8.2 from 7.1.  I've never had 6.1 on my machine.  I am able to install this executible and runtime engine on a machine with 7.1 and can run the *.exe fine. 
    I get a load error and am not sure why.  I have had similar issues with old VI's that I have written in 7.1 executing on this machine w/ 8.2
    any suggestions.
    Attachments:
    error.zip ‏14 KB

  • I can't load some content from my external hard drive to itunes,

    I can't load some content from 1 of my external hard drive to itunes, it can see it and try to load the folder / files but it doesn't appear, these files worked recently as some of them are currently on my ipod touch - I had to factory restore my laptop this week (virus) so have been trying to put everything back on to sync ipod - any ideas???

    To delete files from your external HDD, attach it to your MBP and drag the unwanted files to trash and then empty trash.
    Then you select the files that you want to transfer by 'drag and drop' to the external HDD and trash the files on your MBP.
    Ciao.

  • Can I load the information from my iCloud account that was backed up earlier this year to a new device since my iPad was stolen?

    Can I load the information from my iCloud account that was backed up earlier this year to a new device since my iPad was stolen?

    Yes you can.  iCloud: Restore or set up your iOS device from iCloud

  • HT4101 Can I load photo's from my IPad back onto my SD card through the Camera Connection Kit?

    Can I load photo's from my IPad back onto my SD card through the Camera Connection Kit?

    No, it only supports the copying of photos and videos to the Photos app on the iPad, not from the iPad. You can copy photos that you've copied to the iPad via the kit to your computer : http://support.apple.com/kb/HT4083

  • Does anybody now if I can change my languages settings from Dutch to English?

    Does anybody now if I can change my languages settings from Dutch to English?

    CHange zhe language in the CC app and reinstall the programs.
    Mylenium

  • Whit the new iTunes how i can down load my pictures from the iPhone to the computer  to make more spaces

    whit the new iTunes how i can down load my pictures from the iPhone to the computer  to make more spaces

    Hi shadibader,
    I understand that you wish to import your photos onto your computer from your iOS device. Here is an article for you that will explain how to accomplish this:
    Import photos and videos from your iPhone, iPad, or iPod touch to your Mac or Windows PC - Apple Support
    http://support.apple.com/en-us/HT201302
    Thanks for using the Apple Support Communities!
    Cheers,
    Braden

  • How to load the data from .csv file to oracle table???

    Hi,
    I am using oracle 10g , plsql developer. Can anyone help me in how to load the data from .csv file to oracle table. The table is already created with the required columns. The .csv file is having about 10lakh records. Is it possible to load 10lakh records. can any one please tell me how to proceed.
    Thanks in advance

    981145 wrote:
    Can you tell more about sql * loader??? how to know that utility is available for me or not??? I am using oracle 10g database and plsql developer???SQL*Loader is part of the Oracle client. If you have a developer installation you should normally have it on your client.
    the command is
    sqlldrType it and see if you have it installed.
    Have a look also at the FAQ link posted by Marwin.
    There are plenty of examples also on the web.
    Regards.
    Al

Maybe you are looking for