• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can java language be called as Cross Platform Language?  RSS feed

 
Aashu Mahajan
Ranch Hand
Posts: 114
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can java language be called as Cross Platform Language??
 
Thorsten Schneider
Greenhorn
Posts: 16
Eclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java can be called a platform independant programming language, as long as there is a java virtual machine available for the operating system you intend to run the code on. This is possible due to the java compiler generating java bytecode rather than binaries.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12565
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That all depends on how you define "Cross Platform Language"
 
dennis deems
Ranch Hand
Posts: 808
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
fred rosenberger wrote:That all depends on how you define "Cross Platform Language"


Were you in a hurry? I don't find this response very illuminating.
 
Paul Clapham
Sheriff
Posts: 22841
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dennis Deems wrote:
fred rosenberger wrote:That all depends on how you define "Cross Platform Language"


Were you in a hurry? I don't find this response very illuminating.


You think it's a lazy answer? That could be. It's also a response to something which could certainly be classified as a lazy question.

However if you want to spend some time crafting a decent answer to the question, that would be very welcome.
 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dennis Deems wrote:Were you in a hurry? I don't find this response very illuminating.


He's got a point, though. I've seen loads of discussions about whether something is/isn't cross platform, where it becomes apparent that the difference of opinion is because people have different ideas about what that actually means. Is it enough that the same source code can be compiled on any platform? Or that the result of compilation can be run on any platform? If the latter, what about languages that aren't compiled? Can you call Java cross platform when it has to run on a JVM that is specific to the operating system it's running on?

Once you agree on what the question actually means, the answer is fairly straightforward.
 
Ikpefua Jacob-Obinyan
Ranch Hand
Posts: 394
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello guys...I can see that the bartenders are a formidable force... @Dennis the second part of your question (I don't find this response very illuminating.) sounds better... however EVERYBODY (I am NOT an exemption) is prone to unfriendly expressions...Example I do NOT agree with "could be classified as a lazy question" because the person being refered to may NOT be a native english speaker and may unfortunately have some language restrictions. That said, I agree with those that say java is a multi-platform-computer-programming-language.

Regards

Ikpefua
 
Stephan van Hulst
Saloon Keeper
Posts: 7993
143
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think "platform independence" is a quality that can be sensibly attached to any "language".

A language simply describes which code is legal. Whether or not that code is legal is *always* independent from any machine running it.

I can write a legal C program. The fact that it's legal is independent from the machine it's running on. It does not mean that any particular system has the capabilities or resources necessary to run that program.

Java simply has the advantage that it has a massive standard library that does not depend on any platform.
 
Matthew Brown
Bartender
Posts: 4568
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I remember discussing this in an interview once (quite a long time ago). I'd mentioned Java's "platform independence", and the interviewer challenged this: arguing that if he wrote C++ code according to the ANSI standard he could compile and run that on any platform (with a standards compliant compiler), so how did Java differ from this? My eventual reply was that I thought you could make a distinction between that case, where the source code is transferrable, and Java, where the compiled code is transferrable.
 
Stephan van Hulst
Saloon Keeper
Posts: 7993
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A good way of saying it, I think, is that source code can be platform independent (or not), and that the Java language forces you to write platform independent code.

[edit]

Forces is too strong, let's say urges instead.
 
Paul Clapham
Sheriff
Posts: 22841
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or it tries to force you to write platform-independent code; it's still possible to write Java code which is Windows-specific.
 
Stephan van Hulst
Saloon Keeper
Posts: 7993
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hah yeah, I edited my reply before I saw yours
 
Paul Clapham
Sheriff
Posts: 22841
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's different varieties of platform-independence, too.

Consider Swing as an example. There's a default look-and-feel which looks the same no matter what platform you run it on. That's "Works Identically". And if you don't like that (nobody does) then there's a platform-specific look-and-feel which looks like a standard Windows application on Windows and like a standard Mac application on Mac and so on. That's "Behaves Identically".
 
Ikpefua Jacob-Obinyan
Ranch Hand
Posts: 394
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stephan van Hulst wrote:I don't think "platform independence" is a quality that can be sensibly attached to any "language".

@Stephan...The byte code that is multi-platform or that can run on any JVM that corresponds to a particular platform derives from the "language" you got that byte code from a "language" (java programming language)...a JVM that corresponds to a platform "Is-a" platform(is adapted to a platform)...So why cant the "language-byte-code" be sensibly attached to platform independency?
I said the java prgramming language is a multi-platform-computer-programming-language and a byte code that derives from a language "Is-a" language.
That said I respect your opinion.

Regards

Ikpefua
 
Paul Clapham
Sheriff
Posts: 22841
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's the Java language, and then there's the byte code. Note that this byte code isn't "Java byte code" because it's possible to compile many other languages into that bytes code. So we could discuss whether it's the byte code which is really cross-platform, or whether the language is also cross-platform because it can be compiled into byte code, and so on.

All of which I find rather pointless, but I respect the opinions of a large number of people who disagree with me about that.
 
Stephan van Hulst
Saloon Keeper
Posts: 7993
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Byte code is not derived from Java. Given a proper compiler, code in any language can be translated to byte code.

And byte code is code. Like I said, code can be platform (in)dependent. A language however has nothing to do with platforms. A language simply describes all possible code combinations you can write that are legal. The byte code language describes all valid byte code classes.

If you define a platform independent language as one that only allows platform independent code, then Java is not platform independent, because like Paul already showed, you can easily write code of which the behavior depends on the machine it's run on.

If you're interested in the subject, I recommend reading about language theory and grammars etc.

http://en.wikipedia.org/wiki/Formal_language
 
Bert Bates
author
Sheriff
Posts: 8954
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
bah, humbug, wrong forum, harumpf...






 
Tarun Bolla
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This Topic certainly is great....Let me ask a question

I have written a language + IDE whatever..lets call it X...which has a window...that has a textbox ... which accepts certain commands....
LisFiles --> To list files in present derectory
&coder > code.txt --> To write the contents of variable coder to code.txt

These commands can be executed in a batch just as a shell script too...
I have the X implemented for windows, mac, linux, unix.....

Now is my language platform independent???
 
Ikpefua Jacob-Obinyan
Ranch Hand
Posts: 394
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stephan wrote:Byte code is not derived from Java.


Ikpefua wrote:a byte code that derives from a language.


Stephan...We have argued many times in this forum and I believe that you knew what I meant when I used the word "derives". To the best of my knowledge a language (independently of its state, characteristics, transformations -byte code-) is a medium of communication. Can I even say that javac and the jvm are components of the java language?
You have the right to understand it the best way you determine...Me too.

Regards

Ikpefua



 
Stephan van Hulst
Saloon Keeper
Posts: 7993
143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ikpefua Jacob-Obinyan wrote: Can I even say that javac and the jvm are components of the java language?

Well, this is where I disagree. Javac is a tool that translates code written in Java to code written in Java byte code. There are other compilers that do this as well. You could also write a compiler that translates Java into C code. Java doesn't care about javac. The JVM is even further away from Java. The JVM actually has nothing to do with Java at all. The only thing it cares about is byte code, and I can let it run byte code compiled from Scala or C or XML or something else still.

Anyway, I don't think I have much more to say about the subject that I haven't already, so I'll leave it at that
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!