Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Java in General and the fly likes Java and Windows COM Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java and Windows COM" Watch "Java and Windows COM" New topic
Author

Java and Windows COM

Fedor Smirnoff
Ranch Hand

Joined: Apr 21, 2003
Posts: 45
Hi,

I am looking to enable my java application to do some tasks on the OS level with Windows 2003 server. For example, creating a user and setting permissions. The only way I could think of is through bridging Java and COM. Is it the best way to do it? If yes can you recommend any good Java to COM Bridge libraries.
Steven Martin
Greenhorn

Joined: Dec 03, 2001
Posts: 25
You may also want to look into Ant libraries that support that.
Fedor Smirnoff
Ranch Hand

Joined: Apr 21, 2003
Posts: 45
I am sorry, I didnt understand. Ant libraries support what? COM bridge or Windows level functionality?

Thanks
Randall Julian
Greenhorn

Joined: Nov 21, 2004
Posts: 14
I too am interested in this. I found a couple of references, but I would be curious if anyone has any experience with doing this.

The JACOB project has been recommended more than once - but I have not tried it. Has anyone worked with this?

There is also the Jacobgen project: Jacobgen website which might also help.
Fedor Smirnoff
Ranch Hand

Joined: Apr 21, 2003
Posts: 45
Yes, I also read a lot about JACOB, there is a tutorial on using it in Professional JSP by WROX. I am going to try it. JCOM is another one that I found and its praised as really good, one problem is that documentation is not fully translated to English yet.
http://sourceforge.net/projects/jcom/

Any experience?
Dom King
Greenhorn

Joined: May 19, 2004
Posts: 18
You shouldn't need to resort to COM to "do some tasks on the OS level with Windows 2003 server. For example, creating a user and setting permissions."

This is core Windows OS functionality and it would be easier to accomplish using the Win32 API directly instead of COM.

An simpler and more efficient solution than the overhead of a Java-COM bridge would be to implement one or more native methods using JNI and the Win32 API that do your OS-level tasks, such as "creating a user and setting permissions."

Even if the implementation of the native method itself needed to use COM, that could still be accomplished from the Win32 side of the native method.
Randall Julian
Greenhorn

Joined: Nov 21, 2004
Posts: 14
Since Jacob uses JNI to talk to COM components, it makes sense that you should probably skip the trouble of creating a COM component just to get to things you can get to directly with JNI.

In my case I have a device which comes with a vendor supplied API as a COM component and I'd like to write programs to talk to the device, in Java rather than MSVC++ (ugh).
 
jQuery in Action, 2nd edition
 
subject: Java and Windows COM