Results 1 to 2 of 2
  1. #1
    cachi is offline Member
    Join Date
    Jul 2007
    Posts
    40
    Rep Power
    0

    Default 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:
    Java 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:
    Java 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.

  2. #2
    silvia is offline Member
    Join Date
    Jul 2007
    Posts
    35
    Rep Power
    0

    Default

    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..
    Java Code:
    Long time = (Calendar.getInstance(TimeZone.get...)).getTimeInMillis();
    or
    Java 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.

Similar Threads

  1. How to use Calendar class
    By JavaBean in forum Java Tip
    Replies: 1
    Last Post: 06-26-2008, 03:09 PM
  2. How to use Calendar class
    By Java Tip in forum java.util
    Replies: 0
    Last Post: 04-04-2008, 02:33 PM
  3. Java Calendar Class
    By vasu18 in forum New To Java
    Replies: 0
    Last Post: 12-06-2007, 10:45 AM
  4. help with protected method in vector class
    By katie in forum Advanced Java
    Replies: 1
    Last Post: 08-06-2007, 10:59 PM
  5. Error: convert from String to long
    By bbq in forum New To Java
    Replies: 1
    Last Post: 06-29-2007, 07:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •