I added a key for the execution of a jar using the class that i found in an answer of Boann: read/write to Windows Registry using Java . I'm working in a virtual box virtualized windows 7.
If I add in "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\" a notepad.exe value, it starts at startup.
I wrote in this key the value, and the keyname JAVALL
javaw -Xmx200m -jar
The entire code is:
if (Utilities.WindowsRegistry.isAvailable()) {+
Utilities.WindowsRegistry.writeValue(
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\\",
"JAVALL",
"\"java.exe -jar "+ super.installPathFile + "\" ");
}
Where super.installPathFile is similar at c:\users\kk\desktop\program.jar
But when I try to do the same in a jar in the desktop it doesn't start. I don't know where the error is!
Also another strange problem that I have when I go to the path in the regedit, the keynames and values are different that if I get its using the readValues() function. For example, I added the notepad in the key and it starts correctly, also i can see it in readValues() function. But when I go to the regedit I don't see the same keys that in the function! I'm working in a virtualized windows 7