• Post Reply Bookmark Topic Watch Topic
  • New Topic

Source don't compile with JDK 1.6  RSS feed

 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have updated the version of JDK from 1.5 to 1.6 but i am getting bellow compilation error.



And below is the code which is not getting compiled.



Can anybody please help me fix this issue. Is there any alternative of using LocaleData.getLocaleElements(locale); ???
 
Mike Simmons
Ranch Hand
Posts: 3090
14
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Classes in com.sun.* packages should be avoided for precisely this reason - they can change from release to release, and are not considered part of the public Java API. They are for internal use only, within the JDK.

If you're just trying to get a ResourceBundle, the javadoc for that class suggests using this:
 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, I agree with you mike but i am not able to understand " LocaleData.getLocaleElements(locale); " which resource it's trying to read ? In the example given by you "ResourceBundle.getBundle("MyResources", currentLocale); " you have specified the name of the resource as "MyResources".
 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have now set the correct JAVA_HOME in environment but its still giving me the same error. i am not able to figure out which class its referring to ?

 
Tim Moores
Saloon Keeper
Posts: 4036
94
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure hat you mean by "the correct JAVA_HOME" - apparently LocaleData is no longer part of the JRE, so no amount of legitimate fiddling with the Java setup will bring it back.
 
Koen Aerts
Ranch Hand
Posts: 344
Java Linux Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will have to physically remove any reference in your code to "LocaleData" and use a ResourceBundle as Mike suggests.
 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you are right. but i am not able to understand what should i use to avoid using Sun classes.

Is there any alternative to the below code ?

ResourceBundle.getResource require 2 argument and i don't know the resource name.

 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apparently continued here. Jigar, when you start a new thread for a follow-up question, please provide a link so that other members know that this discussion is over.
 
Jigar Naik
Ranch Hand
Posts: 762
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure Darryl.

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