Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Running code dependent on the java version

835647Feb 4 2011 — edited Feb 5 2011
I deploy my Java program for Java 1.4
but already use modern features of Java 1.6.

The 1.6 code is run using reflection if and only if the JVM version is 1.6 or higher.
This avoids errors during class loading.

Is this the appropriate way? I do not like reflection that much.

But by searching the forum archive,
I did not find a java feature for including specific code for higher java versions
as means of conditional code blocks for certain Java versions.

Thanks Christoph
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 5 2011
Added on Feb 4 2011
16 comments
875 views