Newbie question regarding packages



I am going through a java for dummies book and have an issue compiling
a class. If I use "import com.mysite.util.Console" it compiles fine,
however if I use import com.mysite.util.* it fails. I assume this has
something to do with my CLASSPATH so I will include that as well...
Any insite would be appreciated. Thanks.

C:\javaclasses;.

Compiled Console.class file is in C:\javaclasses\com\mysite\util\

-----------------------------------------------------------------------------------------------
public class PackageTest
{
public static void main(String[] args)
{
while (Console.askYorN("Keep going?"))
{
System.out.println("D'oh!");
}
}
}

-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------

package com.mysite.util;

import java.util.Scanner;

public class Console
{

static Scanner sc = new Scanner(System.in);

public static boolean askYorN(String prompt)
{
while (true)
{
String answer;
System.out.print("\n" + prompt + " (Y or N) ");
answer = sc.next();
if (answer.equalsIgnoreCase("Y"))
return true;
else if (answer.equalsIgnoreCase("N"))
return false;
}
}

}
-----------------------------------------------------------------------------------------------


Snoopy_

.



Relevant Pages

  • Assembly References - User Compiled
    ... I am compiling a class with the CSharpCodeProvider, ... namespace MySpace { ... public class ProcessingClass { ... //Get MyClass Instance ...
    (microsoft.public.dotnet.framework)
  • Re: Simple Java Problem
    ... Fix by setting the classpath, ... putting the referring and the referred to ... "public class Foo" is defined in a file named "foo.java" ... Fix by compiling the class. ...
    (comp.lang.java.help)
  • Re: Newbie question regarding packages
    ... He's responding to the OP's question, which I'm requoting here for the benefit of other readers who may have missed that post. ... I am going through a java for dummies book and have an issue compiling ... public class PackageTest ...
    (comp.lang.java.help)
  • Re: Compiling
    ... I also tried compiling class a using the classpath flag ... This is the source code of a.java ... >From the way i am compiling the aabove two separate files it can be seen ...
    (comp.lang.java.help)