*
The moose likes Java in General and the fly likes Creating Registry Entry for my java program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Creating Registry Entry for my java program" Watch "Creating Registry Entry for my java program" New topic
Author

Creating Registry Entry for my java program

Jonathan Culloty
Greenhorn

Joined: Apr 22, 2006
Posts: 16
Hi!

I've a small java program that displays info in the windows system tray.
I want the program to start on bootup so I've manually added it to the registry under:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

This works nicely but I'd like to automate the registry update if possible, so its easier for people I distribute my program too.
Can anyone suggest a neat way to do this? I'm currently considering
1. Write an installation .bat file to update registry
2. Do the registry update from within my code

Any suggestions or tips much appreciated.
Thanks,

Jonathan
Dawn Charangat
Ranch Hand

Joined: Apr 26, 2007
Posts: 249
One alternate way to edit/add/update the registry manually [other than browsing through the regedit programs explorer interface] is to place the key[with its complete path] and value pair in a *.reg file - save this file, and double-clicking [execute] it.

Why dont we try to create such a file from within your java application and do a runtime.exec(the_reg_file) ???
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41155
    
  45
This may help: How to read the Windows Registry


Ping & DNS - my free Android networking tools app
Jonathan Culloty
Greenhorn

Joined: Apr 22, 2006
Posts: 16
Thanks guys for the suggestions.
I went with the writing to .reg file and calling Runtime on it.
Works nicely
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Creating Registry Entry for my java program
 
Similar Threads
Program Cannot Write To Hard Drive: Windows 7
Java in Windows and MacOS
windows Registry using JAVA
Read values from Registry
how to find the full path of powerpoint.exe?