Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 7th, 2008, 5:33 AM   #1
Lakrids
Newbie
 
Join Date: Dec 2007
Posts: 23
Rep Power: 0 Lakrids is on a distinguished road
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 :
java Syntax (Toggle Plain Text)
  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
java Syntax (Toggle Plain Text)
  1. // ...
  2. import java.util.*;
  3. // ...
  4. PriorityQueue q = new PriorityQueue();
or
java Syntax (Toggle Plain Text)
  1. // ...
  2. import java.*;
  3. // ...
  4. PriorityQueue q = new PriorityQueue();
it gives
Error : PriorityQueue cannot be resolved to a type

What is the problem?
Lakrids is offline   Reply With Quote
Old May 7th, 2008, 5:49 AM   #2
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,722
Rep Power: 5 Sane is on a distinguished road
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.
Sane is offline   Reply With Quote
Old May 7th, 2008, 7:26 AM   #3
Lakrids
Newbie
 
Join Date: Dec 2007
Posts: 23
Rep Power: 0 Lakrids is on a distinguished road
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!
Lakrids is offline   Reply With Quote
Old May 7th, 2008, 8:09 AM   #4
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,722
Rep Power: 5 Sane is on a distinguished road
Re: PriorityQueue problem

No problem. Lucky guess.
Sane is offline   Reply With Quote
Old May 7th, 2008, 11:21 AM   #5
andro
Professional Programmer
 
Join Date: Oct 2005
Location: California
Posts: 280
Rep Power: 3 andro is on a distinguished road
Send a message via AIM to andro
Re: PriorityQueue problem

You need at least Java 1.5
__________________
http://www.kevinherron.com/
andro is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
cration of a new control, problem with adding new controls beni_dude C# 5 Apr 15th, 2008 4:31 PM
Challenging Programming Problem - "Pinball Ranking" Sane Coder's Corner Lounge 38 Jan 15th, 2008 5:16 PM
Problem solving ReggaetonKing Software Design and Algorithms 7 Jan 4th, 2008 1:49 PM
Windows Multimedia API - double buffering problem Brent C++ 1 Dec 21st, 2007 5:52 PM
cgi/perl script + IE problem joyceshee Perl 2 Jan 24th, 2006 11:10 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:29 AM.

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