Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Create a EXE file to write to Registry

Posted on 2003-11-04
6
Medium Priority
?
985 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 92

Assisted Solution

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

Accepted Solution

by:
lwinkenb earned 70 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 60 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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 60 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses

715 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