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 2 of 2

Thread: Problems setting up java files that I downloaded from a publisher's website

  1. #1
    Junior Member
    Join Date
    Feb 2010
    Posts
    10
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Problems setting up java files that I downloaded from a publisher's website

    I am using a data structures book that has 4 files I downloaded from the publisher's website. The 4 files are

    BooleanSource.java
    Washer.java
    Averager.java
    CarWash.java

    I have all of these into one package in Eclipse called CarWashPackage.

    the last file above seems to be the main class using the other 3 classes. It has this information at the top of the file:

    // FILE: Carwash.java
    // This program illustrates the use of the carWashSimulate method which uses
    // a simple queue to simulate cars waiting at a car wash.
     
    import java.util.LinkedList;
    import java.util.Queue;
    import java.util.Scanner;
    import edu.colorado.simulations.BooleanSource;
    import edu.colorado.simulations.Washer;
    import edu.colorado.simulations.Averager;

    I'm trying to coordinate these files together and there are 2 problems:

    1) The import statements above are from what the publisher wrote and refers to the publisher's computer or website and I don't know how to change this to reflect my computer where I have them stored. I have the files on my C drive:
    C:\School\edu\colorado\simulations

    2) at the top of the CarWash.java file, it has a red x saying, "The declared package** does not match the expected package CarWashPackage"

    I don't know how to fix problem 1 or 2


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,330
    Thanks
    181
    Thanked 829 Times in 772 Posts
    Blog Entries
    5

    Default Re: Problems setting up java files that I downloaded from a publisher's website

    Your classpath/packages seem to be incorrect, seems you are trying to import a package that does not exists. If your files are all in the same package, there isn't a need to import them (although it makes it clearer when you do). So my suggestion is to either place your files in a package named edu.colorado.simulations, or remove the import statements (if all classes are in the same path/package).

  3. The Following User Says Thank You to copeg For This Useful Post:

    vendetta (February 10th, 2010)

Similar Threads

  1. Need help compiling java class files
    By peahead in forum What's Wrong With My Code?
    Replies: 5
    Last Post: February 11th, 2010, 08:04 AM
  2. Setting up the Floor for 2d JAva Game?
    By DarrenReeder in forum Java Theory & Questions
    Replies: 1
    Last Post: January 19th, 2010, 05:36 AM
  3. merging two tables from two diffrent htmls files using java
    By sukant_at in forum File I/O & Other I/O Streams
    Replies: 3
    Last Post: September 1st, 2009, 05:13 AM
  4. merging two tables from two diffrent htmls files using java
    By sukant_at in forum File I/O & Other I/O Streams
    Replies: 2
    Last Post: August 7th, 2009, 12:48 PM
  5. Problems in setting classpath
    By missyati in forum Java Theory & Questions
    Replies: 3
    Last Post: June 30th, 2009, 12:43 AM