File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes 1.4 Compiler - 1.3 JRE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "1.4 Compiler - 1.3 JRE" Watch "1.4 Compiler - 1.3 JRE" New topic
Author

1.4 Compiler - 1.3 JRE

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

If I write a program and compile it use the 1.4.1 compiler but I know that all the API's I used are the same as 1.3.x, is it safe to say that the application will run correctly on a 1.3.x JRE?


GenRocket - Experts at Building Test Data
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
I would venture to say probably not. Even though the API spec hasn't changed, perhaps some minor change in the way the two versions create the byte codes in the class file could cause it to not run correctly, if at all. However, if you use a 1.3.x compiler, it should run on both 1.3.x and 1.4.x JREs.
Disclaimer: This is my (only slightly) educated guess. Hopefully someone else will chip in if I am too far off base.


Java API Documentation
The Java Tutorial
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
You can use a 1.4 compiler to create .class files which execute on 1.3 with the -target option:
javac -target1.3 MyClass.java
If your code uses any features that are only available in 1.4, you'll get an appropriate error message when you compile.


"I'm not back." - Bill Harding, Twister
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

What if you don't use the -target option. Any documentation on the difference in bytecode from one version to the other without reading the VM specs for each version and figureing it out? Did anyone just say "Here is the difference"?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: 1.4 Compiler - 1.3 JRE