简体   繁体   中英

java set path hsqldb

I created a simple application to manage members in a database. This programm is running HSQLDB in server mode; all started from within the programm code. The programm is distributed via Installer and of course the user may choose where to install it in. Now, I've noticed a most peculiar problem, which I cannot get a grip on. On my win7 notebook, it doesn't matter where I install the app in; it works like a charm. However, on another computer, only installations outside the programm files folder work. Inside programm files it seems like java cannot find the hsqldb.jar. Adding the whole filepath of hsqldb.jar to PATH does not work and on yet another computer, everything works fine again. Any ideas? (all win7)

I should note that not even starting the server manually via the included runserver.bat seems to work.

The problem your facing deals with changes to the UAC.

You can overcome these by been loaded is admin and having UAC set to low, but this is not an ideal solution. (Under what user Java was installed and the application installed also play apart).

A better solution would to try and place the database in a user acceptable location.

I would suggest trying to use the System property user.dir (ie System.getProperty("user.dir"); ) as the base location. From here, you can make a directory under AppData\\Roaming named after you application and write your application specific data to this location.

This will place your database in, what should be, a writable location for the specific user.

(ps - You don't HAVE to use AppData\\Roaming , you could use AppData\\Local instead if you don't want the settings to follow the user if they are using a roaming profile...or you don't care ;))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM