Solved

Create a EXE file to write to Registry

Posted on 2003-11-04
6
978 Views
Last Modified: 2007-12-19
Hello,
I have Jbuilder 8.1 which can create exe file.
I would like to make a exe file that writes a file to regisrty, like creating a serial number.It is a kind of licencing.How can i do it. I have no idea of writing a file to registry from java.Can anyone help me with a sample program for it.I will use that modify according to my requirement and  create a exe from jbuilder.

Rgds
Mani
0
Comment
Question by:jackiemani
6 Comments
 
LVL 92

Assisted Solution

by:objects
objects earned 30 total points
ID: 9684896
0
 
LVL 5

Accepted Solution

by:
lwinkenb earned 35 total points
ID: 9685004
Basically you have to use JNI to write to the registry, or use some 3rd party tools like the one objects posted.

If you want to write your own JNI library to do this, let me know and I can walk you through it.  
0
 
LVL 15

Assisted Solution

by:dualsoul
dualsoul earned 30 total points
ID: 9685241
just create your dll-function in C/C++ , which will write data to registry. And then use JNI to call it, and pass parameters it needs to write to registry. Thats simple :)
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 15

Expert Comment

by:dualsoul
ID: 9685259
you can find good tutorial on JNI at java.sun.com
0
 
LVL 35

Assisted Solution

by:girionis
girionis earned 30 total points
ID: 9685282
0
 

Author Comment

by:jackiemani
ID: 9691563
THANKS TO ALL ,
I solved it by using preferences api.Since i have to give away points even though was not helping me to my requirement, i will split to all of u.

import java.util.prefs.Preferences;

public class UsingReg {

public static final String REALKEY= "com.hnl.htms";

public static void main(String[] args){
  new UsingReg().doit();
}

public void doit() {
  // write into HKEY_CURRENT_USER\Software\Javasoft\Prefs\com.hnl.htms
  Preferences p = Preferences.userRoot();
  p.put(REALKEY, "1234567767656590298");

  // read back from HKEY_CURRENT_USER
  System.out.println(p);
  System.out.println(p.get(REALKEY, "Error While Writing"));

  // write into HKEY_LOCAL_MACHINE\Software\Javasoft\Prefs\com.hnl.htms
  p = Preferences.systemRoot();
  p.put(REALKEY, "1234567767656590298");
 //Preferences c = Preferences.userRoot().node("com.hnl.htms/Company");
 // c.put("CmpName","Sno");
  // read back from HKEY_LOCAL_MACHINE
  System.out.println(p);
  System.out.println(p.get(REALKEY, "Error No Value"));
  }
}
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
allswap challenge 6 75
Error with Java/Cache JDBC Classpath 2 30
expectj telnet failing 5 19
MySqlDump not dumping triggers 1 13
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now