File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Import not working? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Import not working?" Watch "Import not working?" New topic
Author

Import not working?

Zachary Anderson
Ranch Hand

Joined: Oct 14, 2005
Posts: 49
Base.java has "import java.util.*;" as its seventh line.

JBuilder has a number of warnings about unresolved Time statements. The first of which happens in Base.

So when I run MyProgram, the quiz selector opens, but when I tell it to start the quiz (and start timing), black screen, no images.

And we get: "Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problems:
Time cannot be resolved to a type (copied 10 times)

at ycb.Base.setup(Base.java:268)..."

And here's line 268 of Base: "t.schedule( new Time ( p1a ), time * 1000 );"
(with Time underlined in red)

The most frustrating part is that JBuilder obviously recognizes that Time is a subclass of java.util, since when I right-click on it and ask for the definition, it opens Time.class (extends Java.util.Date).

Soo... how can I get it to recognize that Time is already declared? I could also copy-and-paste and create my own Time class, but that's both disingenuous and poor practice.

Thank you for your time,
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8907
    
    8

I don't see a Time class in the
java.util javadoc. You can't import what doesn't exist.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

Note that there is a Time class which extends java.util.Date. It isn't in the java.util package, though.

If you look in the API documentation which Joe linked to, and go to the page for java.util.Date, you will see a list of classes which extend it. One of them is the Time class which you thought you needed. Follow the link to see what package it's in.

Or alternatively, press the command key which tells JBuilder to generate import statements. (I assume it must have one, I don't use it myself.)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Import not working?