Is Java a Platform independent?

Share

Is Java a platform independent?

During our work in the graduation project a question came to our minds.. is Java a platform independent?

mmm.. according to our readings .. the answer should be..YES!

but according to the last year graduation work, the answer will be turned to NO!
I will not say the reasons in this post, but at least when I got the "Right" definition of "platform indepenedent".
I think the word "platform independent" has another meaning in Java..
So what do u think ? what does platform independent mean?

According to Christopher Blizzard of Red Hat, it's a lie.

al salamo alikom wa rahmat allah wa barakatoh

"Write once, run anywhere?" is totally true in Java, Sun said "Run" not "Run correclty".

Platform Independent means that your program will run, but you should handle the problems of "different platforms" in your code.

example : "new File("ABC\\x.txt")", will run on windows and on Linux also, but incorrectly,  so your code should be "new File("ABC" + File.pathSeparato + "x")" and you should check on the type of running OS to know if you are going to add extension or not.

 al salamo alikom wa rahmat allah wa barakatoh

"you should check on the type of running OS to know if you are going to add extension or not.
"

what for??

I think that Java is a platform itself  and the problem come from other platforms which doesn't apply the standards in their implementations like Microsoft Windows  and Microsoft corporation generally .

Yes Abeer. Java is a platform independent. You can write your java code and get the compiled class files run @any operating system provided that there exists a JVM implementation under the destination operating system.

I recently had a problem @ my work. I had created a web project on WAS 6.0 under Windows OS. And I had a problem when I wanted to deploy the war file @ WAS 6.0 also but on AIX. It was crashing every time of deployment :).

That problem really makes me very confused. But after I give a general look over the project (By the way that look takes 5 hours). I found that the problem was in some of the taglibraries paths which are different in the mapping between both OSes.

The summary is that Java is a platform independent but it needs some maturity to guarantee running its applications "specially enterprise ones" over different OSes.

Yes it's . Java is platform-independent . Read more at wikipedia :

http://en.wikipedia.org/wiki/Platform_independent

As-Salamo Alikom,

I’m agree with what Hazem and Adevedo said I have a little addition that Java is follow a Platform Independent Architecture which means that normal Java application doesn’t call the host OS APIs “Platform” and this where the name Platform Independent came from and I believe you know this.
The question is what about the Bugs we may face in the production like the examples mentioned by Hazem and Adevedo in my opinion there’s 3 causes

1- The JVM Implementation is not standard or contains bugs.
2- The Application itself not designed to work on multiple platforms to e.g. File separator problem or using native APIs
3- The OS kernel not standard and this may lead to different behaviors for the same JVM on different OS versions

And all the above cases is considered as exceptions so the definition of Platform Independent is true even if there’s some exception and in this context by logic it’s acceptable to have a valid rule with some exceptions.

BTW Microsoft mentioned that .NET Framework is platform independent even the implementation of the Framework on different platforms "e.g. linux and solraris" wasn't yet finished in mature way and as I know Microsoft won't implement the Framework on other platform and will leave this to third parties companies or communities to do it and they still define .NET Framework as Platform Independent.

As-Salamo Alikom,

Thanks all for your comments.
Yes, after seeing the definition in Wikipedia i re-thought about the issue now. The definition said "
A cross-platform (or platform independent) software application or hardware device works on multiple system platforms (e.g. Linux/Unix, Microsoft Windows, and Mac OS X). This may mean supporting all common platforms, or simply more than one"

Before reading this info what I knew about platform independent is :"
software application could work on different OSes and hardware devices without changing the implementation (or at least with minor changes)".. and after implmenting parts of our graduation project we discovered that we nearly made the same component on both Mobile and PC with different implementations.. even the recording functionlaties which J2ME uses the wrapped sound packages in MMAPI didn't give the same output in both mobile and PCs. Even In mobile side only, u have to make different implementation and make specific low level configuration to get the quality u want.

These are some of the reasons that made me asked whether it is a platform independent or not. Yes, not following the standards in making JVM, application and OSes sounds logical reason for the output i got.

Thans again and best regards,