Java program power-on self-starter __java

Source: Internet
Author: User
The Java.util.prefs Operation Registry is limited to death under a JavaSoft node and cannot operate on other WINDOWS registry nodes. You must use the C language to invoke the Win32API Access registry function to implement the JNI local interface. There is another way is to invoke the cmd command import java.io.IOException; public class Test {public static void main (string[] args) throws IOException {String key= "hkey_local_machine\\software\\ Microsoft\\windows\\currentversion\\run "; String Name= "myname";//Startup Item name string value= "MyPath";//program Path string command= "reg add" +key+ "V" +name+ "D" +value; Runtime.getruntime (). exec (command); } }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.