Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Executing RegEdit from Java app

Reply
Thread Tools

Executing RegEdit from Java app

 
 
paul brown
Guest
Posts: n/a
 
      01-27-2004
Hi

i'm trying to update my registry from Java (ugly, i know!)

i'm doing this:

public class Registry{
public static void main(String[] args){
try{
Process proc =
Runtime.getRuntime().exec(
new String[]{"cmd",
"/C",
"regedit"+
"/S"+
Registry.REGFILE});
proc.waitFor();
proc.destroy();
}
catch(Throwable th){
th.printStackTrace();
}
}

public static String REGFILE ="regfile.reg";
}


The problem is that when i run the program the registry doesnt get updated.

regedit.exe is on the path of the program.

The registry file is in the working directory of the program.

If i run the 'regedit' command by hand , from a DOS box, using the same
registry file, it works.

Any ideas?

Thanks in advance,
Paul


 
Reply With Quote
 
 
 
 
paul brown
Guest
Posts: n/a
 
      01-27-2004
found the solution:


public void register(){
try{
Process proc =
Runtime.getRuntime().exec(
"regedit /S "+Registry.REGFILE);
proc.waitFor();
proc.destroy();
}
catch(Throwable th){
th.printStackTrace();
}
}


thanks
Paul




"paul brown" <(E-Mail Removed)> wrote in message
news:4015fea3$(E-Mail Removed)...
> Hi
>
> i'm trying to update my registry from Java (ugly, i know!)
>
> i'm doing this:
>
> public class Registry{
> public static void main(String[] args){
> try{
> Process proc =
> Runtime.getRuntime().exec(
> new String[]{"cmd",
> "/C",
> "regedit"+
> "/S"+
> Registry.REGFILE});
> proc.waitFor();
> proc.destroy();
> }
> catch(Throwable th){
> th.printStackTrace();
> }
> }
>
> public static String REGFILE ="regfile.reg";
> }
>
>
> The problem is that when i run the program the registry doesnt get

updated.
>
> regedit.exe is on the path of the program.
>
> The registry file is in the working directory of the program.
>
> If i run the 'regedit' command by hand , from a DOS box, using the same
> registry file, it works.
>
> Any ideas?
>
> Thanks in advance,
> Paul
>
>



 
Reply With Quote
 
 
 
 
Sven Goetgeluck
Guest
Posts: n/a
 
      01-27-2004
hi ,


was wondering how to change keys or add some new keys to the registry

greetings
"paul brown" <(E-Mail Removed)> schreef in bericht
news:(E-Mail Removed)...
> found the solution:
>
>
> public void register(){
> try{
> Process proc =
> Runtime.getRuntime().exec(
> "regedit /S "+Registry.REGFILE);
> proc.waitFor();
> proc.destroy();
> }
> catch(Throwable th){
> th.printStackTrace();
> }
> }
>
>
> thanks
> Paul
>
>
>
>
> "paul brown" <(E-Mail Removed)> wrote in message
> news:4015fea3$(E-Mail Removed)...
> > Hi
> >
> > i'm trying to update my registry from Java (ugly, i know!)
> >
> > i'm doing this:
> >
> > public class Registry{
> > public static void main(String[] args){
> > try{
> > Process proc =
> > Runtime.getRuntime().exec(
> > new String[]{"cmd",
> > "/C",
> > "regedit"+
> > "/S"+
> > Registry.REGFILE});
> > proc.waitFor();
> > proc.destroy();
> > }
> > catch(Throwable th){
> > th.printStackTrace();
> > }
> > }
> >
> > public static String REGFILE ="regfile.reg";
> > }
> >
> >
> > The problem is that when i run the program the registry doesnt get

> updated.
> >
> > regedit.exe is on the path of the program.
> >
> > The registry file is in the working directory of the program.
> >
> > If i run the 'regedit' command by hand , from a DOS box, using the same
> > registry file, it works.
> >
> > Any ideas?
> >
> > Thanks in advance,
> > Paul
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I launch a new Java app from a running Java app? steve.albin@gmail.com Java 3 01-03-2007 04:59 PM
Regedit ??? Please help quick!! =?Utf-8?B?TW91c2U=?= Wireless Networking 1 03-13-2006 12:47 AM
unable find assebly folder in regedit for global assembly cache abidali mohammad via .NET 247 ASP .Net 1 04-14-2005 06:05 AM
Re: regedit Miggsee Computer Support 0 08-07-2003 02:22 PM
Re: regedit Brian H Computer Support 0 08-07-2003 02:16 PM



Advertisments