Page 1 of 1

Error using other classes

Posted: Wed Mar 17, 2004 2:05 am
by AndyT_uk
Ok, so i used to have a class called EasyIn that i used all the time for getting the users input from the keyboard. Now i've been trying to use this file again for another class and i get some weird error messages.

Heres the file i'm using the EasyIn class in.

Code: Select all

class EvenOrOdd
{
	/*
	*	A class that simply tests whether the input is odd or even
	* 	@author Andy Townsend
	*	@version 1.0 (12/01/04)
	*/
	public static void main(String[]args)
	{
		int numberToCheck;
		System.out.println("Please enter a number: \t");
		numberToCheck = EasyIn.getInt();

		if(numberToCheck % 2 == 1)
		{
			//odd
			System.out.println("That number was odd");
		}else
		{
			//even
			System.out.println("That number was even");
		}
	}
}
and heres the errror message i'm recieving when i go to compile it. This code has worked before in the past in many different classes. The easyIn files are also located in the same directory as EvenOrOdd.java /class files.

D:\WORK\YEAR2\JAVA\EvenOrOdd.java:12: cannot resolve symbol
symbol : variable EasyIn
location: class EvenOrOdd
numberToCheck = EasyIn.getInt();
^
1 error

Tool completed with exit code 1

CHEERS for any help people can offer. THis is really starting to annoy me!
:x Only change to the system have been when i installed DJ Decompiler although this has been uninstalled now. I've tried re-installing java but no luck and so i'm just wondering if its a problem with Textpad.

Cheers once again

Andy

Posted: Wed Mar 17, 2004 2:17 am
by s_reynisson
Import your EasyIn class?

Posted: Wed Mar 17, 2004 2:25 am
by AndyT_uk
The thing is i've never needed to do that in the past. It will now compile via the command line using javac -classpath .EvenOrOdds and then runs via java EvensOrOdds.

Just wondering if i can change it in textpad to let me compile it in there again??

Also how exactly do i go about importing the classes. Have tried import EasyIn; but no luck.

Cheers for your help

Andy

Posted: Wed Mar 17, 2004 2:37 am
by s_reynisson
Try adding the working folder to your Java Classpath, it's the "."(dot)
That's assuming your EasyIn class is in the same folder as EvenOrOdd.
Take a look at http://www.textpad.com/forum/viewtopic.php?t=4838
see also http://www.textpad.com/support/faq/java.html

Posted: Wed Mar 17, 2004 1:58 pm
by AndyT_uk
cheers for that m8, finally its sorted :)

And such a stupid error, something must have boned my version of textpad or java as it did use to work properly without that.

Anyways, cheers

Andy