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 / September 2006

Tip: Looking for answers? Try searching our database.

Using mix mode compiling

Thread view: 
mailmetosandeep@gmail.com - 25 Sep 2006 05:49 GMT
Can anyone suggest me a way wherein I can use java 1.5 features and the
source is compilable  with 1.4
I tries out javac -source 1.4
    But by doing so I am not able to use java 1.5 features
If I try to use 1.5 then there are errors on my 1.4 code i.e enum has
been reffered as an object ref but in 1.5 it is an type

I do not want to modify my 1.4 code and also wants to use 1.5 features
as well
Can someone suggest some way out for this

Suppose my class looks like

import java.util.Enumeration;
public class Hello {
       public static void main(String[] args) {
               System.out.printf("hello world"); // 1.5 feature
               Enumeration enum ; // enum is a type in 1.5
       }
}

Now I want to compile it in a go

Thanks in Advance
Sandeep
Manish Pandit - 25 Sep 2006 08:58 GMT
You need to pick what you want to do. You cannot use 1.5 features
without your source being 1.5 compatible. Can you elaborate why you
want to keep your target vm to 1.5 despite coding in 1.5?

Even the -target and -source directives will not allow you to have 1.5
source compiled to a lower version bytecode.

-cheers,
Manish
Manish Pandit - 25 Sep 2006 08:59 GMT
Oops!

> want to keep your target vm to 1.5 despite coding in 1.5?

Please read

want to keep your target vm to 1.4 despite coding in 1.5?

-cheers,
Manish


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



©2009 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.