javac doesn't recognise API class

Joined
Feb 22, 2011
Messages
2
Reaction score
0
I previously wrote:

If I write a simple program like
public class testingthearraylist {
public static void main (String[] args) {
ArrayList testlist=new ArrayList ();
String a=new String ("a");
testlist.add(a);
System.out.println("Size of testlist is "+testlist.size());
}
}
javac (which I'm running from DOS) tells me the class 'ArrayList' is not recognised.

I always thought the library ships with Java. Is there a mistake in my program? Do I have to download the API?

I have found that rt.jar is saved under jre1.6.0, lib, but I have been developing under jdk1.6.0, bin.
Does rt.jar have to be in the path I declare in command prompt? If so, how can I have the paths c\program files\java\jdk1.6.0\bin and c\program files\java\jre1.6.0\lib at the same time?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top