Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Java (http://www.programmingforums.org/forum17.html)
-   -   PriorityQueue problem (http://www.programmingforums.org/showthread.php?t=15789)

Lakrids May 7th, 2008 6:33 AM

PriorityQueue problem
 
Hello,

I am writing a program which needs at a certain point the use of priority queues. For that I use java.util.PriorityQueue. The problem is that javac refuses to compile my code, and I just don't understand why. For the following code :
:

  1. // ...
  2. import java.util.PriorityQueue;
  3. // ...

it says
:

Error : The import java.util.PriorityQueue cannot be resolved
WHY? It is supposed to be there!!
Even with
:

  1. // ...
  2. import java.util.*;
  3. // ...
  4. PriorityQueue q = new PriorityQueue();

or
:

  1. // ...
  2. import java.*;
  3. // ...
  4. PriorityQueue q = new PriorityQueue();

it gives
:

Error : PriorityQueue cannot be resolved to a type

What is the problem?

Sane May 7th, 2008 6:49 AM

Re: PriorityQueue problem
 
Some quick googling suggested that maybe you don't have the version of Java which supports Priority Queues. I am not sure, so maybe you could verify that for me, and/or see if there is a version which doesn't support them.

Lakrids May 7th, 2008 8:26 AM

Re: PriorityQueue problem
 
Yup, apparently I don't have the "Java Collections Framework", which includes the PriorityQueue class, which is very weird, because I thought I installed everything java-related.

Well, thanks for pointing it out!

Sane May 7th, 2008 9:09 AM

Re: PriorityQueue problem
 
No problem. Lucky guess. :)

andro May 7th, 2008 12:21 PM

Re: PriorityQueue problem
 
You need at least Java 1.5 :)


All times are GMT -5. The time now is 4:18 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC