• Post Reply Bookmark Topic Watch Topic
  • New Topic

Win32 Programming Using Java  RSS feed

 
Tony Okusanya
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Forum Members
I appologize if this is a silly question. I was wondering if it is possible to write a simple Java App that is able to use Win 32 API's.
I have used Perl for most of my Windows Administration tasks and would like write some of my tools in Java to aid in my learning the language.
I am familiar with Java and OO concepts (being a CS student) however I havent done much on the job stuff with Java.
So is there a way to say use Java to access Windows WMI or COM service ?
I know its possible to do this in C#

Thanks in advance
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tony, Java was designed to be a platform-independent language. You can compile your programs and run them on almost any device with almost any operating system, from big mainframes, all the different flavours of Unix and Windows to mobile phones.

To make Java as platform-independent as possible, the designers of the language and the standard library left out as many platform-specific stuff as possible. For that reason there is no support for calling the Win32 API from Java in the standard library.

Ofcourse the situation is completely the opposite for C#, which was invented by Microsoft, and Microsoft wants you to use Windows and nothing else - so they made it very easy to use the Win32 API.

But it is not impossible to do platform-dependent stuff in Java. When you want to do this, you usually have to use JNI (Java Native Interface) to call code written in C or C++ from your Java program and have the C/C++ code do the platform-specific stuff.

If you want to use Microsoft COM or ActiveX objects from Java, then there are some libraries available (Jawin for example).

If your goal is to write software only for Windows and you really want to use a lot of Windows specific features, something like C# and .NET might be a better tool for the job than Java.
[ September 08, 2006: Message edited by: Jesper Young ]
 
Tony Okusanya
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the response Jesper I appreciate it. I will continue my training with Java and perhaps boost my efforts by designing other useful apps using Java.
Thanks
 
Srinivas Kalvala
Ranch Hand
Posts: 257
Firefox Browser Hibernate Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

Java is independent of platform.

If the application needs to access the platform specific features, then use java library written with native methods to access it or write native methods to access other language features, but it will affect the portability.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!