File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes how Platfom independent ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how Platfom independent ?" Watch "how Platfom independent ?" New topic

how Platfom independent ?

sac kul

Joined: May 17, 2005
Posts: 8
I am using Java native interface then how my program is Platfom independent ?
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

If you're using JNI, then only the Java part is portable, of course. Depending on what you're doing in JNI, you may be able to write native libraries for other platforms, of course.

This is kind of like asking if a Mercedes is still prestigious if I paint it by hand with nail polish.

[Jess in Action][AskingGoodQuestions]
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Originally posted by sac kul:
I am using Java native interface then how my program is Platfom independent ?

By writing the native code for every platform known to man, of course.

Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Sol Mayer-Orn
Ranch Hand

Joined: Nov 13, 2002
Posts: 311
Previous replies are correct of course...
I just wanted to point out that my company still finds JNI useful, sometimes.

We had a couple of application which extract data from an electric device, then put the results into a database, and also allow you to manage the whole thing through a very complex Swing interface.
The connection to the devices was written in C, and compiled to native code. The database/swing parts were pure java.
Both applications had to run on various platforms (we have Windos 2000, Linux, Mac). So the native part had to be be adjuested for each platform, but at least the db/swing part was re-usable. Roughly, I'd say it saved us a year's work (mainly because the GUI was insanely complex).

Of course, we had a very painful taste of the rule "compile once, test anywhere... and then test it again...".
sac kul

Joined: May 17, 2005
Posts: 8
your answers are great
thanks! Ernest,Thomas,Sol
I agree. Here's the link:
subject: how Platfom independent ?
It's not a secret anymore!