Question:
Do the Java compiler used on one platform differ when used on other?
anonymous
2007-06-13 10:33:02 UTC
Please note that I am asking about Java compiler that converts source code to byte code(Ex: javac) ....but not about JVM.
Four answers:
minus71
2007-06-14 10:04:30 UTC
No.



The java compiler must convert sources into bytecode, which has to be made following very strict standars.



You can even use 3rd party java compilers (I have used jikes for example), which produce same bytecode as the sun or ibm or say-a-name javac.



Naturally the compiler itself is an executable (normally) so you have to use a compier compiled (sorry for the word trick) for the platform you are working with (no javac for linux can run on windows), but that I believe is just common sense.



You can run into some kind of problem if your OS is not correctly supporting UTF-8 names or things like that, or if your source file are writtend with an encoding which differs from the default encoding of the compiler ... ecc.. ecc..



There is a wide range of things that can go wrong when messing with characters above 127 ascii, either than that I can't imagine a situation where a compile can bring different results from one platform to another.



If you have a specific problem ... say it so the reply will be more to the point ...



P.S.: never mess with char above 0x7F in source files ...
?
2016-04-01 09:37:41 UTC
A high-level programming language developed by Sun Microsystems. Java was originally called OAK, and was designed for handheld devices and set-top boxes. Oak was unsuccessful so in 1995 Sun changed the name to Java and modified the language to take advantage of the burgeoning World Wide Web. Java is an object-oriented language similar to C++, but simplified to eliminate language features that cause common programming errors. Java source code files (files with a .java extension) are compiled into a format called bytecode (files with a .class extension), which can then be executed by a Java interpreter. Compiled Java code can run on most computers because Java interpreters and runtime environments, known as Java Virtual Machines (VMs), exist for most operating systems, including UNIX, the Macintosh OS, and Windows. Bytecode can also be converted directly into machine language instructions by a just-in-time compiler (JIT). Java is a general purpose programming language with a number of features that make the language well suited for use on the World Wide Web. Small Java applications are called Java applets and can be downloaded from a Web server and run on your computer by a Java-compatible Web browser, such as Netscape Navigator or Microsoft Internet Explorer. Have a blessed day!
JavaProgrammer
2007-06-13 12:43:33 UTC
Yes....



Different vendor..Different compiler.

Apple writes Mac compilers.

Blackdown writes Linux compilers.

BEA compiler is different.

Sun compiler is different from gcj.....



but all compilers should produce functionally equivalent byte code for the same source code.



Your question is generic.....
coreyog
2007-06-13 10:38:15 UTC
I believe that javac.exe is very intertwined with the rest of the JVM, so I doubt you could just pluck that file from a windows os and drop it onto a MAC or Linux system.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...