I am *brand new* to Java, and am trying to understand how it works on the Wintel platform. I understand that there are free systems from Sun -- namely the JVM and the JRE -- that host Java programs under Windows, but I am unclear about how these are used. If I use Java software from other publishers, do I need another JVM or JRE? Are these typically supplied with the software from other publishers, and, if so, are they different from Sun's? or is Sun's JVM and JRE all I need to run any Java software? I hope this question is appropriate for the beginner's forum, and that it is not too unintelligible!
The JRE (Java Runtime Environment) you have downloaded will run any Java code, regardless of who wrote it. Sun's vision is "write once, run anywhere," and is accomplished in part by the use of platform-independent byte codes. A program written in Java is compiled (using "javac") into a class file (with a .class extension). These class files are usually bundled together in a JAR file (Java ARchive). The class files and JAR files can be run on any platform as long as there is a JVM (Java Virtual Machine) available. So by downloading the Wintel JRE, you can now run any java program, without worrying about whether it was originally developed on Windows or Unix or Linux or Mac, etc. If you want to develop your own Java classes, then you need the JDK (Java Development Kit) which includes the JRE and also the development tools (such as the compiler). All are freely available for most platforms. I've written code on Windows (most versions), Solaris, HP-UX and Linux, and each has a different JRE/JVM, but all run the same java class files w/out recompiling. [ October 23, 2003: Message edited by: Wayne L Johnson ]
posted 15 years ago
Dear Wayne, Thank you for the fast and informative response. I think I understand this much more clearly. To echo my understanding in even simpler terms: for Windows, there is only the Sun JVM and JRE -- no such thing as an "IBM Visual Age" or "Borland JBuilder" JVM or JRE. These systems, and apps that are written with them, can distribute these Sun binaries and these will not be different across vendors (assuming hte same version). Vendors are, of course, free to extend the functionality of the JVM or JRE by adding their own classes and other support files, but the basics remain the same. <ahem> Is this correct? Thanks.
Wayne L Johnson
posted 15 years ago
Sun provides the runtime (JRE) and development (JDK) versions of Java for Solaris, Windows and Linux. I assume they wrote them, but I can't vouch for it: they may have out-sourced some of the development. Novell provides a JDK for NetWare. HP has one for HP-UX, etc. Oracle has embedded a JVM into their database engine. And Java is available on a lot of mobile/cellular devices today. Most [all?] IDE's (such as JBuilder, VisualAge, NetBeans, Eclipse, IntelliJ/IDEA, etc.) come with Sun's JDK, but you can always download and use the latest versions as Sun releases them. And since the JVM spec is published and freely available, there is nothing to stop anyone from writing their own JVM. There are so many resources available on the internet that will help you understand the basic concepts of Java. You might start with the source: Sun's New to Java page. There are lots of good tutorials available from SUN and others. Or you can google and get 100's of thousands of sites to hit. Happy hunting, and welcome to Java!