Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Creating Registry Key

  1. #1
    Member
    Join Date
    Jan 2011
    Posts
    88
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Creating Registry Key

    In my application I am trying to make it run on startup but for what ever reason it wont add to the registry. I've done this manually from the command prompt and it worked fine I've also tried running it as an administrator with no luck and I am not getting any error messages. Heres my code:

    public static void windowsStartUp() {
    		try {
    			String s = System.getProperty("file.separator");
    			String data = "javaw -jar " + Mmrgh.config.dir + s +"Mmrgh" + Mmrgh.config.VERSION + ".jar";
    			Runtime.getRuntime()
    					.exec("reg add HKLM" + s + "Software" + s + "Microsoft" + s + "Windows" + s + "CurrentVersion" + s + "Run" + s + " /v Test /t REG_SZ /d \""
    							+ data + "\" /f");
    		} catch (IOException e) {
    			if (Mmrgh.config.DEBUG_MODE)
    				e.printStackTrace();
    		}
    	}


  2. #2
    Member
    Join Date
    Jan 2011
    Posts
    88
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Default Re: Creating Registry Key

    Nevermind I just fixed it!

Similar Threads

  1. Can anyone help with my code please?? (Reading the Registry)
    By mozza in forum What's Wrong With My Code?
    Replies: 3
    Last Post: February 9th, 2012, 11:27 AM
  2. Reading the registry
    By mozza in forum Java Theory & Questions
    Replies: 2
    Last Post: January 31st, 2012, 11:33 AM
  3. Can multiple servers share one RMI Registry?
    By vavavoom in forum What's Wrong With My Code?
    Replies: 0
    Last Post: December 2nd, 2011, 12:12 PM
  4. Java Installation with no Registry Key?
    By ch103 in forum Java Theory & Questions
    Replies: 1
    Last Post: October 20th, 2011, 06:41 PM
  5. JFM Registry error
    By mp3rara in forum AWT / Java Swing
    Replies: 4
    Last Post: April 16th, 2011, 03:51 PM

Tags for this Thread