Cannot find symbol error in cmd but not in IDE

I'm trying to compile the following code (one of two files I need to complete this homework) but I'm getting 2 errors in cmd. This is what cmd throws at me:

CarRentalTest.java:12: error: cannot find symbol
        CarRental myCarRental = new CarRental(); //create CarRental object CarRental
        ^
  symbol:   class CarRental
  location: class CarRentalTest
CarRentalTest.java:12: error: cannot find symbol
        CarRental myCarRental = new CarRental(); //create CarRental object CarRental
                                    ^
  symbol:   class CarRental
  location: class CarRentalTest
2 errors

And this is the code I'm trying to compile.

public class CarRentalTest {

    public static void main (String[] args)
    {
        CarRental myCarRental = new CarRental(); //create CarRental object CarRental
        myCarRental.Customers();

    } //end method main

} //end class CarRentalTest

What's weird is that the whole thing runs fine in NetBeans. What am I doing wrong here? :9

Jon Skeet
people
quotationmark

What am I doing wrong here?

Not building CarRental, or not telling the compiler where to find the class if you have already compiled it. The IDE is probably assuming you want to build everything, so that's fine.

We don't know how your code is organized, but you should either pass all the relevant filenames to the compiler at the same time:

javac -d classes src\CarRental.java test\CarRentalTest.java

... or put the output directory of the earlier compilation in the classpath for the later compilation, e.g.

javac -d classes src\CarRental.java
javac -d testclasses -cp classes test\CarRentalTest.java

people

See more on this question at Stackoverflow