• 0

J2sdk 1.4 (and 1.3) Problem


Question

**"IMPORT" problem???**

I'm working with drivers and objects right now. My last class project was to create a Hi-Lo type of card game where a card would be drawn..then the user would have to guess if the next card would be higher or lower... We had to create an object called "PlayingCard." So in the driver..of course we had to use "import PlayingCard;"...Now this is where the problem is: when i try to compile the driver..i get the error "cannot resolve symbol" where the carrot is pointing under the "i" in "import PlayingCard;"... Also, in the driver program we had to create two cards "PlayingCard c1 = new PlayingCard();" and "PlayingCard c2 = new PlayingCard();"... When trying to compile there is also the same "cannot resolve symbol" error..with the carrot pointing under the "P" in the "PlayingCard ......."

I already checked the obvious..case sensitives and all... The weird thing is that on my friends comp..he is able to successfully compile my driver and object. The same thing goes for when I use the computer at school. It works without changing anything. My friend has the same problem..he can't compile on his machine running XP..but he can on his machine running 2000. We thought it was an OS problem..but my machine is running XP (the one that works for him). So what could be the problem?? I tried reinstalling, tried 1.3 and 1.4, etc etc.

If anyone has a solution..please help! Thanks in advance!!

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

import PlayingCard; ???

What is this? The Package name, or the Class name?

If it is a Package name, you need to indicate with Class to import. You can simply import all classes of the Package, using:

import PlayingCard.*;

If it is a Class name, you must indicate the package it belongs.

import packagename.PlayingCard;

But if the driver is from the same Package of the PlayingCard (resides on the same folder), you don't need to import anything.

Relating to the second error, is class PlayingCard in PlayingCard.java file?

If you can't figure it out, you can post your code, and I'll see what's the problem.

Link to comment
Share on other sites

  • 0

Thanks for your reply dude...

The driver and PlayingCard are both in the same folder (actually..a floppy disk). In 1.3 you would need the import..but in 1.4..i know it's not needed. I tried both versions with accordingly..and they don't work. And yes PlayingCard is in PlayingCard.java...

As I said earlier..the weird thing is that compiling the driver on my machine (and now i also found out on my friends and girlfriends machine) results in the same error. However, the school's computer and my other friend's machine is able to compile it..WITHOUT changing anything on the driver or playingcard. That's the weird thing. I know it's not an OS problem (mine is XP..and my friends' comps who also have the error run on 98 and 2000, respectively). Could it be our actual computers?? I really don't know... Any other ideas?? If so..please share..it's greatly appreciated! :)

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.