|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
|||
|
|||
|
Keyboard lib
Hi,
I got the following errors when I tried to import the keyboard package. How do I fix the problem? Thanks. Code:
import cs1.Keyboard;
public class ReadString
{
public static void main (String[] args)
{
String message;
System.out.println ("Enter a line of text:");
message = Keyboard.readString();
System.out.println ("You entered: \"" + message + "\"");
}
}
C:\ReadString.java:4: package cs1 does not exist import cs1.Keyboard; ^ C:\ReadString.java:18: cannot find symbol symbol : variable Keyboard location: class ReadString message = Keyboard.readString(); ^ 2 errors |
|
#2
|
|||
|
|||
|
Presumably your instructor has provided this library. They should have also provided information on how to use it. You will need to pass the -classpath or -cp command line argument to the "javac" command.
__________________
Need Java help? Want to help people who do? Sit down with a cup of Java at the hotjoe forums. |
|
#3
|
|||
|
|||
|
stdunbar,
I am not sure what you mean "You will need to pass the -classpath or -cp command line argument to the "javac" command." Could you please give me an example? I found the Keyboard library in the cs1 folder and moved the cs1 folder in the folder of my code. Everything works fine now. Thanks. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Java Help > Keyboard lib |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|