Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2006

Tip: Looking for answers? Try searching our database.

Quick Question: Can a 1.4* VM run 5.0 compiled bytecode?

Thread view: 
Danno - 22 Apr 2006 03:26 GMT
I guess I am looking in the wrong places.  Your help is appreciated.
Roedy Green - 22 Apr 2006 04:03 GMT
>Re: Quick Question: Can a 1.4* VM run 5.0 compiled bytecode?
no, not unless you used target -1.4. It does not have support for the
new features.
Signature

Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.

Danno - 22 Apr 2006 17:26 GMT
Thanks Roedy.   I just have a popular WebStart based system, and trying
to program in some upgrades as easy as possible for the end users.
Most use 1.4.2. and I don't really want to inconvenience them by having
them move to 5.0 yet.   The thing I like is the new easymock, junit,
and easymock extensions that make use of 5.0 features.

But you know, now that I am typing this.  I think I can use 5.0 on my
unit tests to test 1.4.x code.  Hmmm.
Chris Uppal - 22 Apr 2006 11:02 GMT
> I guess I am looking in the wrong places.  Your help is appreciated.

Why not just try it ?

Anyway, the answer is no.  The 1.5-generated classfiles have a version flag in
them to tell the JVM that they use features which were introduced in 1.5, and a
1.4 JVM will recognise the flag and refuse to load those classfiles.   You can
compile Java passing the -source 1.4 or -target 1.4 (I forget which) flag to
Sun's javac which will produce 1.4-compatible bytecode, but then the compiler
will refuse to recognise the new 1.5 language features.

I believe there are Java compilers which are not as stunted as the Sun one, and
which can compile most 1.5 features into a form which will run on a 1.4 JVM.  I
can't  make any specific recommendations, though.

   -- chris
Danno - 22 Apr 2006 17:30 GMT
Thanks Chris for the detailed response.  The reason I don't want to try
is because I worked for 12 hours programming away already.  ;)  There
are times where throwing out the question will be a lot simpler. ;)

I was leaning towards yes for a while because I was thinking that a lot
of features were compile-based but translated to the regular 1.4 style
bytecode that we were all used to.  But then I thought about
annotations late at night, and annotations are a part of the bytecode
if so requested.
Chris Uppal - 22 Apr 2006 18:33 GMT
>  The reason I don't want to try
> is because I worked for 12 hours programming away already.  ;)  There
> are times where throwing out the question will be a lot simpler. ;)

Understandable !

   -- chris
Piotr Kobzda - 22 Apr 2006 15:49 GMT
> I guess I am looking in the wrong places.  Your help is appreciated.

Try this http://retrotranslator.sourceforge.net/

Regards,
piotr
Timo Stamm - 22 Apr 2006 17:07 GMT
Piotr Kobzda schrieb:

>> I guess I am looking in the wrong places.  Your help is appreciated.
>
> Try this http://retrotranslator.sourceforge.net/

Or: http://retroweaver.sourceforge.net

Timo


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.