• 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

Is java completely P.Indpendent ????

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Well I read in so many books that One of the Java's feature is
"It is platform Independent"
write once & run anywhere

But I also heard people saying that java is not completely
platform Independent .

I have been to Sun Developers Day & on that day also I heard one of the speaker saying same thing & I coudn't ask him why as I was new to java?

So
would you please mind me putting some light on it
I want to know whether Java is totally platform Independent or not?
If It is more or less platform Independent then please eloborate on it?

Thanks
[ April 19, 2005: Message edited by: Waez Ali ]
 
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java is platform independent because for java to run it needs a JVM.
The JVM(Java Virtual Machine) is platform dependent.
JVM converts java into the target system understandable format.
that is why you have different JVMs for different Operating systems.

windows JVM will translate java into a format which it will understand.
linux JVM will translate java into a format which it will understand.

and so on.

well this is what i think it is. please correct me if there is anyone who knows different.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The goal is for the JRE to present all the same APIs and features to your programs on every platform, so programs can run on any JRE and thus any OS without change. In practice there are some subtle differences that can give you trouble. These may be defects or places where implementors interpreted the Java specs differently. My team develops on Windows and deploys on AIX. We externalize things like file paths to configuration, but we don't have any platform incompatibility issues that I know of.
 
Waez Ali
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi James,

can you please elaborate on

In practice there are some subtle differences that can give you trouble. These may be defects or places where implementors interpreted the Java specs differently



How implementers can interpret Java Specs differently can u please give me any example of it?


Thanks
 
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is also possible to create code that is "platform independent" in that it will compile and run, but not so because it does not function correctly. Prime examples are things like hardcoding file separators (using "\" will not work on Unix platforms).

There used to be a nice article on 'Platform-Independence' versus 'Portability' on Sun's website but I can't seem to find it now.
 
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Threading and garbage collection can operate differently depending on platform.
 
Ranch Hand
Posts: 808
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java also supports native methods and JIT compiling, both of which damage (if not destroy) the cross-platform compatibility.

Don't you just love a simple answer to a simple question!?
 
Stan James
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yknow I said there are some gotchas in compatibility just within the language but then I couldn't think of any. At work we develop on XP (and NT until last year) and deploy on Solaris and AIX with no problem at all.
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Normally there will be no problems. But if you use specific things that you shouldn't but can (like fixed filenames and paths, depending on specific threading implementations, etc.) or if you depend on JNI you're locking yourself into a specific OS.

And with JNI there might be options to isolate the impacted areas so they can be provided for different OSs.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic