Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-06-2007, 08:07 PM
Member
 
Join Date: Jul 2007
Posts: 40
cachi is on a distinguished road
Error: Cannot access protected member long getTimeInMillis() in class Calendar
Hi, I am coding a cross-platform piece of code, which explicitly needs to be backwards (and forwards) compatible, between various versions of Java.

However, another problem is that it also needs to be VM cross compatible (between Sun JVM 1.2+ and Microsoft JVM 6.0+).

The requirement is to compile using Microsoft JDK (jvc.exe) 6.00.8343.

I have a piece of code that looks something like this:
Code:
long time = Calendar.getInstance(TimeZone.get...).getTimeInMillis();
This works fine under Sun JDK (1.3.1), but under Microsoft, it spits out the following error:
Code:
java\xxx\yyy\Zzzzz.java(4129,57) : error J0203: Cannot access protected member 'long getTimeInMillis()' in class 'Calendar' from class 'Zzzzz.Zinner'
Where could I find the API specification document for the Microsoft JDK Calendar class; or what would be another way of achieving this (another method that's both public and common to both JDK perhaps)?
Thanks.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-07-2007, 09:53 AM
Member
 
Join Date: Jul 2007
Posts: 35
silvia is on a distinguished road
I couldn't find any api specifications for Microsoft's JVM. The closest I found was a message from Microsoft telling users to move off their JVM by December of 2007 to Sun's as they will no longer be supporting it (Sun won their lawsuit).

But to help with the error, have you tried separating it out? Or maybe moving paren's around? For example..
Code:
Long time = (Calendar.getInstance(TimeZone.get...)).getTimeInMillis();
or
Code:
Calendar ctemp = Calendar.getInstance(TimeZone.get..); Long time = ctemp.getTimeInMillis();
It seems odd to me that Microsoft wouldn't provide this functionality despite it being in the java source code.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use Calendar class JavaBean Java Tips 1 06-26-2008 05:09 PM
How to use Calendar class Java Tip java.util 0 04-04-2008 04:33 PM
Java Calendar Class vasu18 New To Java 0 12-06-2007 12:45 PM
help with protected method in vector class katie Advanced Java 1 08-07-2007 12:59 AM
Error: convert from String to long bbq New To Java 1 06-29-2007 09:23 PM


All times are GMT +3. The time now is 11:44 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org