ss_blog_claim=752cdf4fa7cc7b60527b400da1af07d5

Written on July 27th, 2009 at 2:27 am by Shunmugha

7 Comments

How to use Windows API in Java?-Solution

We all know that Win32 API’s are Powerful and provide great features and ability from getting Window handles,Spawning new process,killing process ,Send Keystrokes ,Tweaking Registry, Logging lots and lots more.

But how to use Windows API in Java ,this is sure to make your Java Application Power packaged and versatile and also eases your work.It will be really useful for those who write Java Application for Windows Platform.

How to use Win32 API in Java?

1.Visit this page http://www.jamesyoung1.com/jDownloadsV2.shtml

2.Download copy of JWinAPI .JWinAPI Download

3.Install the setup.And you are Ready to go.

4.Include JWinAPI.jar in your Project Library.

5.Done!

Demo :

For Demo Go to the directory where you have installed JWinAPI. Type:

<strong>java -jar JWinAPI.jar </strong>

Demo Code of how to use JWinAPI:

Poping up Message Box:

WinAPI wapi = new JWinAPI();
	wapi.doMessageBox("JWinAPI DLL has been loaded successfully!",
			"JWinAPI", MBConstants.MB_OK + MBConstants.MB_ICONASTERISK );

Accessing Windows Registry From Java Example

// write an int value
	wapi.doWriteToRegistry(REGConstants.HKEY_CURRENT_USER,
		"Software\\jamesyoung\\regsample",
		"javaINTValue",	REGConstants.REG_DWORD, new Integer(123456 ) ) ;

See what are the functions supported by JWinAPI:

JWinAPI Doc

Hope it was Useful!

, , , , , , , , , , , ,

7 Responses to “How to use Windows API in Java?-Solution”


  1. ganda

    1 year ago

    Great dude. Thankx for this. Its been a while I search about how to access win api through java application. you help me much. Thanx buddy!


  2. admin

    1 year ago

    You are always Welcome ganda..


  3. Maksym

    11 months ago

    I get “no JWinAPI in java.library.path” AWTException on Windows Vista.
    Trying to run my desktop app with JWinAPI.jar distributed. JWinAPI is
    not installed on the system.

    Is this a bug or I should force user to install JWinAPI before
    running my app?


  4. Shunmugha

    11 months ago

    @Maksym

    Yes ,you should first ask your user to install JWinAPI…

3 Trackbacks For This Post

  1. How to Access Windows Registry from Java-API’s | Technobuz Says:

    [...] http://technobuz.com/2009/07/how-to-use-windows-api-in-java/ [...]

  2. Posts about plugins as of July 27, 2009 | All About WordPress Says:

    [...] How to use Windows API in Java?-Solution – technobuz.com 07/27/2009 We all &#107&#110&#111w that Win32 API’s are Powerful and [...]

  3. Detecting system user privileges on XP OS? - Java Programming Forums Says:

    [...] Detecting system user privileges on XP OS? How about this. How to use Windows API in Java?-Solution | Technobuz Generated Documentation (Untitled) // [...]

Leave a Reply