Solved

Create a EXE file to write to Registry

Posted on 2003-11-04
6
979 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

776 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