Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: "The import ___ cannot be resolved" (stupid noob question)

  1. #1
    Junior Member
    Join Date
    Dec 2010
    Location
    Inland Empire
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default "The import ___ cannot be resolved" (stupid noob question)

    Hey... I'm VERY new to Java. I've made several attempts to start learning it and always end up frustrated early on. I'm doing it again, this time using the Watij unit-testing framework.

    I've setup Eclipse (which I use for my regular job, ColdFusion programming), and setup the jars and added them to my classpath and stuff. Now I have a sample I'm trying to run:

    package watijTest;
     
    import org.watij.webspec.WebSpecTestCase;
     
    public class Test extends WebSpecTestCase {
     
         public void test_something() {
              WebSpec = new WebSpec().mozilla();
              spec.open("http://www.google.com");
              String resultHTML = spec.source();
              assertTrue("needs to contain google", resultHTML.contains("google"));
         }
    }

    And Eclipse is complaining on two lines... the "import" line and the WebSpec = line, likely related to the same problem in the import line.

    And being completely new to this, I'm not sure what to do about this error. It sounds like it isn't finding something someplace.

    What am I doing wrong?

    Thanks!

    Rob


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: "The import ___ cannot be resolved" (stupid noob question)

    It sure seems like that package/class isn't on the classpath properly. Make sure you're adding the folder that contains the org folder.

  3. #3
    Member goldest's Avatar
    Join Date
    Oct 2009
    Location
    Pune, India
    Posts
    63
    Thanks
    1
    Thanked 12 Times in 10 Posts

    Smile Re: "The import ___ cannot be resolved" (stupid noob question)

    Make sure that, jar file containing "org.watij.webspec.WebSpecTestCase" class structure is on the class path where eclipse can see / refer from it.

    Plus, if the WebSpec class is in some other package structure, make sure to import it in the right way.

    If possible, post the error that eclipse is complaining about.

    Hope that helps!
    Goldest
    Java Is A Funny Language... Really!

    Sun: Java Coding Conventions

    Click on THANKS if you like the solution provided.
    Click on Star if you are really impressed with the solution.

Similar Threads

  1. Replies: 6
    Last Post: November 12th, 2010, 04:40 AM
  2. [SOLVED] "possible loss of precision", except not, code doesn't work, simple question
    By Perd1t1on in forum What's Wrong With My Code?
    Replies: 2
    Last Post: July 24th, 2010, 07:11 PM
  3. Java says:"Hello World". I say:"It works!"
    By Davidovic in forum Member Introductions
    Replies: 4
    Last Post: June 29th, 2010, 07:13 AM
  4. "java.lang.NoSuchMethodError: main" and "fatal exception occured."
    By joachim89 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: January 10th, 2010, 08:35 AM
  5. Arrays: question about "removing" items.
    By sanfor in forum Collections and Generics
    Replies: 2
    Last Post: November 30th, 2009, 04:09 AM