• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Can we have jdk6 on jre5?  RSS feed

 
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Java Guru's. I have a very simple question.
Can I have jdk 1.6 and only jre5 to execute a java class? Is jdk backward compatible with jre?

Actually i have a scenario. I wanted to write a code to use woodstox parser. Now in documentation it is written that it requires jdk 1.6 wheras I have jdk 1.5 and jre 1.5
I got compilation problems while writing the code. I then installed jdk 1.6 and jre 6. The compilation problems got resoleved and I was able to run the code successfully.
But now I have been told that we cannot change the jre version from 5 to 6. So I was just wondering if I can still have my code run on Jre5 which is compiled using jdk 6

Thanks,
Shyam
 
author
Sheriff
Posts: 23589
138
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Shyam kumar wrote:Can I have jdk 1.6 and only jre5 to execute a java class? Is jdk backward compatible with jre?



Java is backward compatible -- not forward compatible. Meaning Java 6 can run Java 5 code, but not the other way around. However, you can use the javac "-source" and "-target" flags to compile using only specific constructs, and to generate class files for specific java versions.... Regardless, it is still a good idea to actually have a Java 5 jre installed, as you need to actually test it.

Shyam kumar wrote:I got compilation problems while writing the code. I then installed jdk 1.6 and jre 6. The compilation problems got resoleved and I was able to run the code successfully.



Maybe it would be a good idea to figure out the compilation error instead. After all, when you put the compiler into compat mode, you will likely encounter the same compiler error (if it works correctly).

Henry
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!