File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes java compilation process Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "java compilation process" Watch "java compilation process" New topic

java compilation process

Cristian Negresco
Ranch Hand

Joined: Sep 15, 2001
Posts: 182

I would like to know some details about the java compilation procedure.

Is it so that compiling with javac 1.4.2_01 will build classes which run with whatever 1.4.2_0x version of the jre?

Could I get some professional view/ details about the issue, what is happening while compiling and how the version of the compiler is tied to the classes it compiled?

Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

There's a version number embedded in each .class file. In general, the number changes only with a major JDK release: 1.3, 1.4, 1.5 all have different version numbers. Each version of the JVM can read its own class files, and those of all previous versions, but not "future" versions.

Changes in class version numbers generally indicate the use of new JVM capabilities (like for example assertions or generics); things that simply won't work on older JVMs.

The class file version doesn't change for minor releases like 1.4.1, 1.4.2, etc, and of course not for patchlevels like 1.4.2_01, 1.4.2_02. Minor releases add or change a small number of methods or classes in the API, and patch versions generally fix bugs without changing the API at all.

Does that help?

[Jess in Action][AskingGoodQuestions]
Cristian Negresco
Ranch Hand

Joined: Sep 15, 2001
Posts: 182
Yes, thanks, it did.

I agree. Here's the link:
subject: java compilation process
It's not a secret anymore!