ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Java is compiled into byte code, which is then interpreted by the Java Virtual Machine (JVM).
There are also "Just in Time" compilers which, instead of interpreting and executing the byte code, compile the byte code into native code and pass it to the OS for execution.
In addition to the byte code from your own classes, Java also provides its own built-in classes. You can consider the combination of JVM (byte code interpreter) + all the standard runtime classes as the "Java Runtime Environment" (JRE).
When someone executes your Java program, they need a (JRE == ((JVM || JIT) + standard run-time classes)).
All of the above, of course, is also pretty much 100% applicable to .NET.
And none of it's applicable to JavaScript. Netscape changed the name from "LiveScript" to "JavaScript" at the last minute, for purely marketing reasons. Java and Javascript have little or nothing in common, except the name and except for somewhat C-like syntax.
Other benefits include the ability to dynamically load at the class-level (instead of just at the library level), the possiblity of real-time ("Hotspot") performance optimization and (another biggie) automatic memory management/garbage collection. Compactness (especially important for distributed/web based apps), security (ditto) and flexibility (another variation of the "dynamic loading" argument) come to mind.
Again, the pros/cons for Java are almost indistinguishable from the pros/cons of .NET.
Byte code is machine readable, not human readable. One of the main reasons for doing it is to abstract away the OS specific stuff so that code compiled on one platform, can run on any platform that the JVM will run on. Because the JVM takes care of memory management, it also removes the need for things like pointer manipulation.
I'm generalising - of course there are exceptions and disadvantages in the real world, but it has worked well on many of the projects I've been involved in.
what is byte code? is it programmer readable? Why would one do programming this way as opposed to straight binary code(a la C, C++)?
Java bytecode is instructions for the Java virtual machine, which is kind of like machine code, but more abstract. It has the advantages that it is compiled, so that it only represents the instructions and so many languages can be compiled to it; while at the same time it is not specific to any specific processor or machine architecture, but can easily and quickly be run on any processor architecture using the Java virtual machine.
Neither of these sites necessarily *mean* anything in terms of the question "which programming language will be of most use to me five years from now?", or even "should I be a CS major ... or go into Business ... or French Literature?" But they're definitely both interesting reading ;-)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.