Preferences...Setting Database Default Directory

i have a JAR file that accesses a database outside of it, but im having a problem of how to put the db in the place that i want it to go. right now its directory is set to C:\Documents and Settings\Alex\.javaphonebook, using this code, from 1 of the classes inside the JAR: String userHomeDirectory = System.getProperty("user.home", ".");
        String systemDirectory = userHomeDirectory + "/.javaphonebook";
        System.setProperty("derby.system.home", systemDirectory);
        File databaseDirectory = new File(systemDirectory);
        databaseDirectory.mkdir(); but what i want is to have the db in the same directory as the JAR (at this point its in D:\Program Files\Java Phonebook) without having to hardcode it, so that my program can be used on different systems in any directory. this what the derectory looks like now: http://www.MyOnlineImages.com/Uploads/Images/3726778475000javaphonebook.bmp and this is what i want it to look like: http://www.MyOnlineImages.com/Uploads/Images/3726867537501javaphonebook2.bmp any help would be appreciated, thnx

ah k. im not too sure how this program works. i read
the commenting but i still have no clue. maybe u
could help me out? :)The VM uses a ClassLoader to load classes from various places (file system, inside JAR files, network, etc).
You can get the ClassLoader object by calling
ClassLoader classLoader = SomeClass.class.getClassLoader();which may be 'null' in which case you use:
classLoader = ClassLoader.getSystemClassLoader();Once you have the ClassLoader, you can ask it for the location of a particular class file:
String className = SomeClass.class.getName();
String classFileName = className + ".class";
URL someClassURL = classLoader.getResource(classFileName);
String urlString = someClassURL.toExternalForm();This gives you a String showing where the class file is located. For a class in a JAR file the String looks something like this:
jar:file:/C:/Junk/jartest.jar!/JarTest.classFor a class file not in a JAR file it might look like this:
file:/C:/Junk/JarTest.classSo, for classes in a JAR file the String starts with "jar:file:/"
You strip off that part using
String filename = urlString.substring(10);which leaves:
C:/Junk/jartest.jar!/JarTest.classDo some more String manipulation to strip off the "!/JarTest.class" leaving:
C:/Junk/jartest.jarOne more bit of String manipulation gets you:
C:/Junkwhich is the directory in which the JAR file is located.
So using only the Class object for a class that you know is in a particular JAR file, you can determine where in the file system that JAR is located, which is also where your database is located.

Similar Messages

  • How to set database default temporary tablespace in 8i?

    SQL> alter database default temporary tablespace temp3;
    alter database default temporary tablespace temp3
    ERROR at line 1:
    ORA-02231: missing or invalid option to ALTER DATABASE

    As far as I know, in Oracle 8i, you can not set the temporary tablespace as default at the database level; rather you can set it at the user level.
    SQL> alter user scott default temporary tablespace temp3;
    In Oracle 8i, the created users without specifying the default temporary tablespace, those users will by default assign to SYSTEM as default temporary tablespace.
    You may need to assign the temp3 temporary tablespace to all the users.
    Regards,
    Sabdar Syed.

  • How do I set a default directory location for opening projects?

    Hi there.
    Using Windows 7. 
    What I mean is when I click on Open Project I want it to always go to the same location, namely C:\Users\Julian\Desktop\Documents\Adobe\Premiere Pro\6.0\Projects
    Each time I try to open a Project it seems to always go to some other random directory in My Docs.
    I've looked for this in Preferences but cannot locate it.
    Any ideas?

    I just tested the Open Project function, and it appears to default to the location of the last project you had opened.
    That said, I don't recommend saving project, or anything associated with your project, on the C: drive.
    Adobe recommends a dedicated drive for video editing, and I've always saved my projects and all associated media on that separate drive. Not a big fan of the "My Documents" folders. Sure you can access them from the desktop, to a degree, but when in the Windows Explorer, stuff is buried too many folder down for my tastes. Makes it difficult to locate files later on.
    I have a drive V: for video and will create a New Folder there when starting a new project. The Project gets saved there, as well as an video, audio, graphics, etc., and I do create sub-folders to organize those assets as inside the main folder.
    Thanks
    Jeff Pulera
    Safe Harbor Computers

  • CSV Export - can you set a default directory?

    Can the "Save As" folder be defaulted to a specific location when exporting a report as CSV?
    I want to try and get all users to store the exported csv files in the same location rather than having them saved on local C:\ drives or various other network locations.
    I'm using HTMLDB 1.6 on Ora9.2

    Theoretically yes but practically NO!
    If yes, then user should install ActiveX(for IE) or java (FF and others) which will be called to determine that setting.
    But my suggestion is to leave that setting alone...
    BTW, any download that you have done on Interent...was it automatically or was guided by your decision?
    ;-)

  • Setting a Default Directory in Acrobat

    I cannot for the life of me find any way to change the Acrobat default files directory from "My Documents" to a directory of my choosing. Can someone please help me with this??

    You should blame MicroSoft in part. That is the default in Windows packages. I do not know how the MAC works. I just opened WORD and it opened to My Documents. It apparently can be changed, but I never tried (probably in the folders tab of options). Many folks have asked for this change in AA over many years and it still works this way.

  • How do I set the default directory that adobe opens from and saves to.

    Every time I open a document, adobe looks for files in skydrive.  To get to my files, I have to back up a level, change to the c: drive, go to users, and then pick the folder my files are in.  Does anyone know where I can find and change the defalt file location.

    Thank you for your reply Rob. That is a pity because I have loaded some 500 eBooks and each Cover page appears in the Navigation sidebar with real Pictures and Videos interspersed seemingly randomly. I have also tried to move my stuff into separate folders called Pictures and Videos. Wheareas the Pictures moved successfully, the Videos didn't show in the Videos Folder. I think this is a bug.
    Is there another Media Player on the HP App site that is worth trying? 

  • Set default directory/path for SaveAs Dialog using WPG_DOCLOAD

    Hi, im trying to set the default directory/path for the SaveAs Dialog called by wpg_docload.download_file.
    I'm not able to find where I can specify the default path.
    Is it something like "htp.p('Content-Disposition: attachment; path=:PX_OUTPUT_DIR" ?
    Thx for your help !
    Here's a part of my code
    owa_util.mime_header( NVL(mime,'application/octet'), FALSE );
    htp.p('Content-length: ' || length);
    htp.p('Content-Disposition: attachment; filename="'||substr(fileName,INSTR(fileName,'/')+1)|| '"');
    owa_util.http_header_close;
    wpg_docload.download_file( lobLoc );
    /*********************/

    I don't believe you're allowed to set the directory path in the Content-Disposition (or any other) header. More accurately, you can set path in the filename, but browsers don't pay any attention to that, they only look at only the terminal filename.
    <p>According to RFC 2183, browsers are supposed to ignore any path information sent with the filename. Even though it's dated 1997, I believe this RFC is still in effect.
    <p>This was done as a security precaution against malicious web apps that might try to download into a system directory or other dangerous place. Also, browsers (usually) allow users to specify their own default download directories. Further, even if you could specify the path, you'd have to do it for any and all filesystems (Linux, Mac HFS, Mac OSX, Windows, etc etc).

  • Setting Default Directory When Scanning

    I have Acrobat 8 Professional. Most of what I do is scanning
    documents and I would like the documents to go into one particular
    directory or a parent directory and then allow me to choose a child
    directory.
    I have not been able to find a place to set a default
    directory.

    Thank you for your response. These forums are specific to the
    Acrobat.com website and its set of hosted services, and do not
    cover the Acrobat family of desktop products. Please visit the
    following forums for any questions related to the Acrobat family of
    desktop products:
    http://www.adobeforums.com/cgi-bin/webx/.3bbeda8b/

  • Set a default value to checkbox on Active Directory form

    Hi all
    how to set a default value to checkbox UD_ADUSER_MUST on Active Directory form?
    I set the value 1 on the column default value (ADUSER form), i try the provisioning resource AD to the user and this field is not selected.
    please help me.

    hi
    My problem is solved, I tried to change the default form ADUSER, but this value was overridden by the policy form.
    I set this value in the policy form.
    thanks

  • How to set the default value of a database column to NULL

    Hello,
    I want to set the default value of a column (VARCHAR2(20) to NULL, nut I cannot figure out to do this. I tried the following editing the offline table with JDeveloper:
    Default Value : <empty> -> On database NULL
    Default Value: '' -> On database ''
    When I create a new column, there is no default value on the database side and when I open the tabe properties in the database navigator I can see that the default value is (null). This is what I want to see in the other column as well. I don't know why sometimes a default value is visible on the database side (when generating form offline tables to database tables) and sometimes not.
    Perhaps sombody can bring some light in this issue.
    Thanks Thomas

    Hello Shay,
    I have the impression that you don't understand my problem. So here step by step:
    1. Create a offline Table TEST with one column TEST: VARCHAR2(20). nullable=true, no default value.
    2. Generate the table to the database
    3. When you look at the table properties (columns) with the database navigator the following information is displayed (sorry for the formatting):
    Column Name | Data Type | Nullable | Data Default | COLUMN ID| Primary Key | COMMENTS
    TEST | VARCHAR2(20 BYTE | Yes | (null) | 1 | (null) | (null)
    4. Now set the default value for the column TEST in the offline table for example to 'Test'
    5. Generate the table to the database.
    6. When you have a look at the database table, the default value is now 'Test' (as expected)
    7. Now remove the default value of the column TEST in the offline table
    8. Generate the table to the database
    9. When you have a look at the database table, the default value is now NULL (in uppercase letters without parenthesis)
    And this is where the problem starts!
    When you generate the table again with the options "Alter/Manual Reconcile" the default value of the column test is considered to be different! But in fact it should'nt be different because nothing has been changed.
    Best regards Thomas
    Edited by: thmayr on May 28, 2009 9:05 AM
    Edited by: thmayr on May 28, 2009 9:31 AM

  • Set default directory and file permissions

    I'm trying to use setfacl to set the default permissions for directories and files but I get an error saying "sudo: setfacl: command not found." What I am trying to do is share a specific directory on a local external drive connected by Thunderbolt. Everyone in the group has access to the drive and can view all the files but once a new file is created, the group permissions are not updated. Here is an example of two PDF file. The one created by userA only has permissions for that user where the file created by userB allows all users to open and modity the file.
    -rw-------   1 userA    staff   1988176 Feb 13 15:09 TestFile01.pdf
    -rwxr-----+  1 userB  staff   1827102 Feb 13 15:05 TestFile02.pdf
    0: group:MarketingGroup allow read,write,append,readattr,writeattr,readextattr,writeextattr,readsecurity
    I can manually update the permissions through the Get Info window but this requires me to reset permissions every time a person saves a new file to the drive. There needs to be a way to do this automatically.
    Here is what I tried but the setfacl command is not supported.
    sudo setfacl -Rdm g:GroupName:rwx /DirectoryPath

    Thanks Frank. I have an externat drive connected to my Mac via Thunderbolt. On this drive I have a specific directory that I'm shairing with Mac and PC users. I've created a group on the network to limit access to this directory to specific users. That works perfectly. The issue I'm having is when one of these users creates a new file in this directory or any of it's subdirectories, no one has permission to open or edit the file. Right now I'm using Get Info to modify the permissions of the folder and all enclosed items. When I check the permissions of the files I've "corrected" I notice this extra imformation "0: group:MarketingGroup allow read,write,append,readattr,writeattr,readextattr,writeextattr,readsecurity." This is not included when I check the permissions of items saved by other uses in the group.
    So my question is how do I set the default permissions for this directory so every new file and directory will have the correct permissions to allow anyone in this group full access to open and modify every file?
    Thanks for your help!!!!

  • Does anyone know how to change where incoming (via mail) calendar requests go on my MacBook? Mine insist on going to Entourage, which I don't use any more. I've tried setting the default calendar in iCal preferences. Doesn't help. Bugs me. Can you help?

    Does anyone know how to change where incoming (via mail) calendar requests go on my MacBook? Mine insist on going to Entourage, which I don't use any more. I've tried setting the default calendar in iCal preferences. Doesn't help. Bugs me. Can you help?

    Jneklason wrote:
    ~snip~
    I know this email is confusing and really hard to understand...perhaps now you will know how i've been feeling--lost and confused with all the mis-information, with a hit and miss phone, and out of time with all the 1 1/2 hr to 2 hrs EACH wasted on this issue.
    On top of all this, I can't even find out how to file a complaint with anyone higher up than Customer Service.
    I hate to tell you this, but you didn't write an email. You wrote a discussion post on the Verizon Wireless Community forum which is a public peer to peer forum. Unfortunately since you didn't mark your post as a question, the VZW reps that roam this community won't ever see your post. Before you re-post it, don't. Duplicate posts get removed from the community.
    I see there were several missteps both by the reps and yourself in your post. First you should have insisted on returning the phone within the 14 day return policy period. Second which Samsung Galaxy mini model did you purchase? The S3 mini or the S4 mini? Did you do any research prior to deciding on this device. The reps at that time deflected the easiest course of action, by trying to get you to replace the phone under insurance instead of returning the phone. The Early Edge payment option requires the current phone on the line using the early Edge must be returned to Verizon Wireless. Did you once considered going to a third party site like Swappa to purchase a gently used device for your daughter?

  • How to set default directory for SQL LOADER

    hi all,
    i wanted to know how can we setup a default directory for SQL LOADER if at all we can. i connot place my control and data files in local system and use them at command prompt. rather i wanted to know if we can set default directory that the loader can use. this requirement is basically to enable all the clients to upload the data placed on the server and use the loader utility.
    thanks in advance,
    Basavraj

    Ella,
    You don't say which version of SQL Developer you are using via Citrix, but just setting the SQLDEVELOPER_USER_DIR hasn't worked for a long time (see Re: SQLDEVELOPER_USER_DIR does not function anymore). Also, since version 1.5, the default for the user directory (now set via ide.user.dir as shown below) is under the user profile area (relative to %APPDATA%), which you should be able to write to, even on Citrix.
    Assuming that neither of those help, you will need to get whoever installed SQL Developer on the Citrix C: drive to modify the sqldeveloper.conf to have a line like, where the path exists for everyone who will be using the shared SQL Developer (assumes everyone has a H: drive):
    AddVMOption -Dide.user.dir=H:\sqldeveloperAn alternative (depending on how you start SQL Developer via Citrix), is to create your own shortcut to start SQL Developer with something like:
    sqldeveloper -J-Dide.user.dir="%SQLDEVELOPER_USER_DIR%"theFurryOne

  • How to set the default language in preferences- dictionary- language

    Hi guys,
    i like to set the default dictionary language as well as the lookup path of the dictionary via script. I've found the property dictionary path as well as some settings for qoutation under languages with vendors:
    app.languagesWithVendors[INDEX OF LANGUAGE].name
    app.languagesWithVendors[INDEX OF LANGUAGE].dictionaryPaths
    Thats fine, but how can it set a certain language with vendor as the default language for the application itself? Under the Preferences->Dictionary dialog, I can find a dropdown showing the default language. But how can I access this default or set it?
    The application object has a property object called dictionaryPreferences, but this object only contains some flags like the merge behaviour but not the default language itself. So where is it?
    app.dictionaryPreferences.mergeUserDictionary
    Menue
    Dialog
    API

    Ok guys,
    in the meantime I think I got it. I can setup  several dictionaries for several languages. Depending on the language I use in my paragraph styles the according dictionary will be used. Fine for the desktop.
    But what about the InDesign Server! I use the server via scripting and SOAP ports, webservice calls. I've launched several webservice ports, like 10001,10002,10003,10004. In this case, I can set up a vendor dictionary by providing a path via script send to one port 10001 for example. But here are two problems:
    1. The other InDesign Server instances aka webservice ports and engines won't get informed about the change. I have to run the script on all instances.
    2. The change only lives as long as the instance is running but doesn't get saved. After restart the instance, the setup got lost.
    So can I save the dictionary-setup with an pref-xml file, all InDesign Server instances would use and read per default?

  • Workspace Preferences -- Setting the right default values

    Good afternoon --
    We are in the midst of rolling out Hyperion Planning 9.3.x along with Financial Reporting, SmartView, etc. to a large population (~1000 users). We would like to be able to set and/or reset certain user preferences.
    The most salient example is Financial Reporting > General > User Point of View > Preview --- default setting is "Off" but this causes user confusion and support calls the first time users log in. Is there a way for us to set the default to "On" for all users instead?
    [Other potential examples -- default start-up content, PDF vs. HTML Preview, position of the POV]
    Thanks,
    Jason

    user10174749 wrote:
    Good afternoon --
    We are in the midst of rolling out Hyperion Planning 9.3.x along with Financial Reporting, SmartView, etc. to a large population (~1000 users). We would like to be able to set and/or reset certain user preferences.
    The most salient example is Financial Reporting > General > User Point of View > Preview --- default setting is "Off" but this causes user confusion and support calls the first time users log in. Is there a way for us to set the default to "On" for all users instead?
    [Other potential examples -- default start-up content, PDF vs. HTML Preview, position of the POV]
    Thanks,
    JasonOur Oracle consultants helped us to setup the preference "Preview" be "On" by scripts.

Maybe you are looking for

  • How do I restore my disk permissions?

    I'm running 10.6.7 on a 2.8GHz i5 iMac.  Was having issues so I ran disk repair followed by repair disk permissions in Disk utility (something I know now that I should not have done).  Now I'm locked out of my external drives (padlocks on the desktop

  • I have a Pavilion 25bw screen. not compatible with window 8.1

    I have been trying to upgrade to windows 8.1 from 8.0 64 bit  Everytime I do, I get a flashing screen.   Finally after a year of problems a windows tech figured out that the drivers for this screen are not compatible and that HP does not have an upgr

  • External Isight camera & 2012 Macbook Pro not recognized

    Hello, External Isight camera connected to 2012 Macbook Pro through Firewire.  Green light on camera comes on but camera is not recognized in Photo Booth or FaceTime.  Also does not show up in hardware. Hope someone can help, Dan

  • My custom alert sounds

    I had thought, previously, that I had put my custom alert sounds in System:Library:Sounds with the other Apple made alerts, but they're not to be found there so where else might I look for them?

  • HELP! Container on large product won't expand with content

    Everyone, I am at my wit's end. I'm almost finished optimizing my site for tablet but I can't figure out why the containing div around the large product won't expand. I've tried everything! It's fine on mobile and desktop but for some reason it won't