Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2007

Tip: Looking for answers? Try searching our database.

Writing to Vista registry with Java

Thread view: 
JediKnight2 - 04 Nov 2007 20:11 GMT
One of my programs uses jRegistryKey.jar and jRegistryKey.dll to write
to the registry.  Basically it tells windows weather to start the
application on Windows Startup or not.  Well, this all works fine in
XP, but with Vista it doesn't work and from what I see no update is
given on the Sourceforge page.  Anything like jRegistryKey around that
can replace this.

Again, in my application I have an option under View>"Launch on
Startup"  if it is set, it starts on Windows startup and sets the
proper key to do that under HKLM\Software\Microsoft\Windows
\CurrentVersion\Run\MyProgramLauncher   The application is installed
in the Program Files folder.

Any suggestions?
Owen Jacobson - 04 Nov 2007 21:52 GMT
> One of my programs uses jRegistryKey.jar and jRegistryKey.dll to write
> to the registry.  Basically it tells windows weather to start the
[quoted text clipped - 10 lines]
>
> Any suggestions?

You may be running afoul of Vista's compatability shims.  Certain keys
and certain filesystem paths are redirected to per-user versions of
themselves when accessed by apps running as a non-admin user.  This is
intended to minimize the number of crashes under non-administrator
accounts for apps that assume they have admin privs, such as yours.

jRegistryKey is writing to the key you're requesting, but Windows is
redirecting that write.  In order to have an application run at
startup, you must make the appropriate changes *as an Administrator*.
Any other registry manipulation library for Java would encounter the
same behaviour, as it's part of Windows now.

The right solution is probably to disable or remove that menu item
entirely unless the user is an administrator, or to dig through the
UAC docs on MSDN to find out how to escalate your privs for the
duration of the registry change.  The WRONG solution is to tell users
they have to run as an admin; that's the sort of thing the entire
internet has been trying to get Windows users away from because it's
so bloody hazardous.

Details here: <http://msdn2.microsoft.com/en-us/library/bb530198.aspx>
Roedy Green - 04 Nov 2007 21:57 GMT
On Sun, 04 Nov 2007 12:11:13 -0800, JediKnight2
<JediKnight2@gmail.com> wrote, quoted or indirectly quoted someone who
said :

>Any suggestions?

A lot of vista problems have to do with permissions.  Try the
run-as-administrator option when you run you app.  Right click the
properties on the launch icon to set it.

If that does not work, check with the  jRegistryKey authors to see if
they know what is going on.  

If that does not work, write traditional C++ code to poke the
registry, and look up to it with JNI.

Hold your nose. The code required is disgustingly verbose.
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.