Page 1 of 1

JAVA kicking and screaming

Posted: Wed Feb 26, 2003 3:26 am
by Bob
Fter spending time learning C++, we have to change to JAV at school. I bought a bok and it not only came with Java but included Textpad. Since the genius that wrote code for JAVA failed toinclude a keyboard input routine, I need to find one and install it and pray that ava and Textpad uses it.... otherwise Jva is just like watching a movie--- no input!
I acqured a Keyboard class --- it's included in a Cs1 folder/package.... and not matter how many copies of this Cs1 folder I place throughout my hard drive...... and extra copies of the Keyboar.class file... each and every time I try to use a program that uses Keyboard routine for text input I receive an error message on compiliing that java can't find the Cs1 class. I nowmust be a DOS guru in order to configure and run Java and textpad...... seems like this language is not worth the effort! H E L P. I altered my autoexec.bat file both for path and classpath.. still no luck in using the Keyboard class.
I'm almost ready to quit and relate myself to useing the ancient DOS window for simple Java programming.... and this is progress?!!
Sorry for the cynical attitude- someone far smarter than I should have created a better interface with Java to avoid this glaing omission.... and someone at Java and or Textpad should have self extracting files so that the Keyboard class will actually import...... any help will be greatly appreciated----- quickclick@aol.com

Re: JAVA kicking and screaming

Posted: Wed Feb 26, 2003 3:05 pm
by Berend Veldkamp
Why don't you try the Java forum (http://www.textpad.com/forum/list.php?f=2)

What the ?

Posted: Sat Mar 15, 2003 2:37 am
by Guest
First, the cs1/keyboard class is for use within a .java source file and
has nothing to really do with getting TextPad to work.

Here are a couple of tips...

Assume working directory for your source is c:\SRC,

Within the c:\SRC directory, install the folder called CS1 and put the keyboard class in there...


Here is a source file....


import cs1.Keyboard;

public class Methods
{
/*
* This is the main section. From here, we do all method calls
*/
public static void main(String[] args)
{
System.out.println("Question #4: Counting Up");
boolean errorFlag = true;
int kbdInput;

do
{
System.out.print("Enter an integer between 1 and 20: ");
kbdInput = Keyboard.readInt();

if ( kbdInput < 1 || kbdInput > 20)
{
System.out.println("Sorry, out of range....");
}
else
{
countUp(kbdInput);
errorFlag = false;
}
} while ( errorFlag == true );
System.out.println(" ");

/*
* This method takes one argument of type int. This argument
* must be between 1 and 20. If it isn't, we display a message
* to the user that they goofed. If it is valid, we will count up to
* that number from 1 on the screen.
*
* NOTE: To simplify the program, I used the keyboard class.
*/
static void countUp(int end)
{
for ( int i = 1; i <= end; i++ )
{
System.out.print ( i + " ");
}
System.out.println(" ");
}
} // end of class 'Methods'