Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java compilation process

 
Cristian Negresco
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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?

Thanks,
Cristian
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Cristian Negresco
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, thanks, it did.

-Cristian-
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic