• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Win32 Programming Using Java

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 257
Hibernate Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic