ive been in a cs103 class (java programming) for a couple months now, and my SimpleInput class has always worked just fine until i tried writing a few really basic programs today. i am getting an error on my machine that i had never gotten before, and it goes as follows during compilation:
C:\Documents and Settings\Russ\Desktop\sumNum.java:14: cannot resolve symbol
symbol : class SimpleInput
location: class sumNum
SimpleInput keyboard = new SimpleInput();
C:\Documents and Settings\Russ\Desktop\sumNum.java:14: cannot resolve symbol
symbol : class SimpleInput
location: class sumNum
SimpleInput keyboard = new SimpleInput();
2 errors
i found that to be quite strange, as everything else works, and i tried one of the instructor's sample javas and was given the same error. i am running the newest textpad, the newest java, and winxp is totally up to date. any ideas? the assignment is due tomorrow morning and i would really like to get this working!
resolve symbol error
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
-
- Posts: 4
- Joined: Thu Feb 26, 2004 11:35 pm
- Location: fairbanks, alaska
- s_reynisson
- Posts: 939
- Joined: Tue May 06, 2003 1:59 pm
Try using Search with the keyword string "cannot resolve symbol".
Make sure you tick "Search for all terms", you should get about 20 hits. HTH
Make sure you tick "Search for all terms", you should get about 20 hits. HTH
Then I open up and see
the person fumbling here is me
a different way to be
the person fumbling here is me
a different way to be
-
- Posts: 4
- Joined: Thu Feb 26, 2004 11:35 pm
- Location: fairbanks, alaska
hey thanks
now that ive wasted my time looking through 400 search results (btw none of them were worth crap), would you mind actually helping me?
- s_reynisson
- Posts: 939
- Joined: Tue May 06, 2003 1:59 pm
Hmm, sounds like you did not tick the "Search for all terms", I only got 20
hits, including your post.
Did you look at this http://textpad.com/forum/viewtopic.php?t=4959 ?
Also found
- http://textpad.com/forum/viewtopic.php?t=4290
- http://textpad.com/forum/viewtopic.php?t=4292
and a classic one about the keyboard and input
http://textpad.com/forum/viewtopic.php?t=4413
not sure if that's related to your problem though.
Hope this helps, if not, maybe someone else would care to jump in,
my Java speak does not cover this.
hits, including your post.
Did you look at this http://textpad.com/forum/viewtopic.php?t=4959 ?
Also found
- http://textpad.com/forum/viewtopic.php?t=4290
- http://textpad.com/forum/viewtopic.php?t=4292
and a classic one about the keyboard and input
http://textpad.com/forum/viewtopic.php?t=4413
not sure if that's related to your problem though.
Hope this helps, if not, maybe someone else would care to jump in,
my Java speak does not cover this.
Then I open up and see
the person fumbling here is me
a different way to be
the person fumbling here is me
a different way to be
- talleyrand
- Posts: 624
- Joined: Mon Jul 21, 2003 6:56 pm
- Location: Kansas City, MO, USA
- Contact:
Assuming the aforementioned threads don't help, check the basics (filename case matches class case, the code compiles from the command line, etc.) Assuming it passes all that, post your code (assuming it's not too lengthy). If it does fail the others, you can probably still get help here but there are better forums for pure Java help (Sun's board comes to mind). If nothing else, I enjoy troubleshooting code but I'm also masochistic.
I choose to fight with a sack of angry cats.
-
- Posts: 4
- Joined: Thu Feb 26, 2004 11:35 pm
- Location: fairbanks, alaska
yeah... uhh
i spoke to my instructor, and he told us to move a .class file to the same directory as our .java file. i believe it was simpleinput.class but i cant seem to find it. any clues? oh yeah here is my .java
// Class: prntStrs.java
// Author: Russ Gillmore
// Date: 3-12-04 (w00t spring break)
// Description: This program will print out a number of stars as is
// requested by the user.
public class prntStrs
{
//main method
public static void main(String[]args)
{
//initialize
SimpleInput keyboard = new SimpleInput();
int ii;
System.out.println("Enter the number of stars to be shown: ");
//take input from user
int stars = keyboard.nextInt();
//print the required number of stars
for(ii=0; ii<=stars; ii++)
{
System.out.print("*");
}
} //end of main method
}
// Class: prntStrs.java
// Author: Russ Gillmore
// Date: 3-12-04 (w00t spring break)
// Description: This program will print out a number of stars as is
// requested by the user.
public class prntStrs
{
//main method
public static void main(String[]args)
{
//initialize
SimpleInput keyboard = new SimpleInput();
int ii;
System.out.println("Enter the number of stars to be shown: ");
//take input from user
int stars = keyboard.nextInt();
//print the required number of stars
for(ii=0; ii<=stars; ii++)
{
System.out.print("*");
}
} //end of main method
}
-
- Posts: 4
- Joined: Thu Feb 26, 2004 11:35 pm
- Location: fairbanks, alaska
oops
well, it looks like thats a different .java than the one i had before, but nonetheless i get the same error.
- talleyrand
- Posts: 624
- Joined: Mon Jul 21, 2003 6:56 pm
- Location: Kansas City, MO, USA
- Contact:
I'll let you debug the logic error. Save this out to prntStrs.java Compiles and executes, except for the bug, just dandy. java 1.4.1_01
If you have either the SimpleInput.java or SimpleInput.class file (capitalization must match) place it in the same directory as this file and remove my definition of the class from this file.
If you have either the SimpleInput.java or SimpleInput.class file (capitalization must match) place it in the same directory as this file and remove my definition of the class from this file.
Code: Select all
import java.io.*;
public class prntStrs
{
//main method
public static void main(String[]args)
{
//initialize
SimpleInput keyboard = new SimpleInput();
int ii;
System.out.println("Enter the number of stars to be shown: ");
//take input from user
int stars = keyboard.nextInt();
//print the required number of stars
for(ii=0; ii<=stars; ii++)
{
System.out.print("*");
}
} //end of main method
}
/**
* Just a guess at what this class looks like
*/
class SimpleInput
{
/**
* Get something from stdin.
* @return The thing they typed into the keyboard converted to a number.
* Return 0 if bad data
*/
public int nextInt()
{
String foo = "";
int out = 0;
try
{
InputStreamReader tempReader = new InputStreamReader(System.in);
BufferedReader reader = new BufferedReader(tempReader);
foo = reader.readLine();
out = Integer.parseInt(foo);
}
catch(NumberFormatException ex)
{
System.err.println(foo + " is not an integer");
out = 0;
}
catch(Exception ex)
{
System.err.println("Something else broke -> " + ex.toString());
}
return out;
}
}
I choose to fight with a sack of angry cats.