Shifu
Shifu

Reputation: 3

Adding calendar source files in Java problem

I am trying to create a calendar instance.

I have imported the java.util.calendar but when I mouse over my code to create a calendar instance, it tells me that it cannot find the element in the attached javadoc or the source file.

From researching on google, I tried adding rt.jar but it hasn't changed anything.

When I look at the Calendar Class Editor, it tells me (apart from not finding the source):

 "//  (version 1.5 : 49.0, super bit)
  // Signature: Ljava/lang/Object;Ljava/io/Serializable;Ljava/lang/Cloneable;Ljava/lang/Comparable<Ljava/util/Calendar;>;
  public abstract class java.util.Calendar implements java.io.Serializable, java.lang.Cloneable, java.lang.Comparable {..."

I have tried to look for these jar files on the computer too and I cannot find them. Does anyone know what I need to attach to resolve this problem?

Code Snippet:

 import java.util.*;
 .....
 Calendar cal = Calendar.getInstance();
 cal.add(Calendar.DATE,2);
 .....

Upvotes: 0

Views: 348

Answers (1)

Didier L
Didier L

Reputation: 20579

You need to use the JDK's src.zip as source attachment for the rt.jar library. This zip file can be found at the root of the JDK's installation directory (usually C:\Program Files\Java\jdkx.y.z\src.zip)

Upvotes: 2

Related Questions