>> Where is PackageTest running from? Where are you running the java
>> command from (which directory)?
>>
> ?? What ??
> What is "Package Test" and "java command"??
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.
<quote>
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;
}
}
}
-----------------------------------------------------------------------------------------------
</quote>
- Oliver