Solved

Create a EXE file to write to Registry

Posted on 2003-11-04
6
977 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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
triangle challenge 4 77
IT Company 5 69
countAbc challenge 9 49
eclipse java  build path 6 21
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
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 …

757 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

18 Experts available now in Live!

Get 1:1 Help Now