-2

How to save and retrieve password in key registry?
How to Protects key from editing and deleting?
If key deleted, How to know the person authorized to enter application?

  • 1
    possible duplicate http://stackoverflow.com/questions/62289/read-write-to-windows-registry-using-java – David Oct 31 '12 at 09:48

3 Answers3

0

You can't directly in Java. Java bytecode runs in a protected environment agnostic to any windows registry or other windows functionalities. You'd better implement a dll in C/C++ to read/write to the registry and then make a JNI wrapper to call the dll methods right from your java program.


Maybe I've been misunderstood your question: are you talking about the windowskey registry, right?

Gianluca Ghettini
  • 11,129
  • 19
  • 93
  • 159
  • This is incorrect, you can call the windows registry from Java, see link http://stackoverflow.com/questions/62289/read-write-to-windows-registry-using-java – David Oct 31 '12 at 09:49
  • @david99world: You're wrong. As you can see looking at the library you are referring to it's not pure java code, it's a x86 DLL and some JNI glue code, exacly what I was talking about... – Gianluca Ghettini Oct 31 '12 at 09:59
  • That library does use JNI that I linked in my answer, I merely stated it IS possible - look at the first answer in the link I provided, that only uses reflection. http://stackoverflow.com/questions/62289/read-write-to-windows-registry-using-java – David Oct 31 '12 at 10:07
0

You can do it just using Java code but the example below uses external x86 native win32 DLL and some JNI glue code as in:

http://sourceforge.net/projects/jregistrykey/

Although it's not been updated since 2011.

Look at the first answer below to see that it can be done using just reflection.

read/write to Windows Registry using Java

Community
  • 1
  • 1
David
  • 19,577
  • 28
  • 108
  • 128
0

you can use my libary, just import .jar file and use it like showed in .java main.

It can create keys, read them and also encyript them for secure password storage. It uses 128bit AES

https://github.com/stefanvozd/HalRegistry

You can also take source code and modify for your needs.