resolve symbol error

Using the Java SDK with TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
screwzloos
Posts: 4
Joined: Thu Feb 26, 2004 11:35 pm
Location: fairbanks, alaska

resolve symbol error

Post by screwzloos »

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!
User avatar
s_reynisson
Posts: 939
Joined: Tue May 06, 2003 1:59 pm

Post by s_reynisson »

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
Then I open up and see
the person fumbling here is me
a different way to be
screwzloos
Posts: 4
Joined: Thu Feb 26, 2004 11:35 pm
Location: fairbanks, alaska

hey thanks

Post by screwzloos »

now that ive wasted my time looking through 400 search results (btw none of them were worth crap), would you mind actually helping me?
User avatar
s_reynisson
Posts: 939
Joined: Tue May 06, 2003 1:59 pm

Post by s_reynisson »

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.
Then I open up and see
the person fumbling here is me
a different way to be
User avatar
talleyrand
Posts: 624
Joined: Mon Jul 21, 2003 6:56 pm
Location: Kansas City, MO, USA
Contact:

Post by talleyrand »

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. :twisted:
I choose to fight with a sack of angry cats.
screwzloos
Posts: 4
Joined: Thu Feb 26, 2004 11:35 pm
Location: fairbanks, alaska

yeah... uhh

Post by screwzloos »

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
}
screwzloos
Posts: 4
Joined: Thu Feb 26, 2004 11:35 pm
Location: fairbanks, alaska

oops

Post by screwzloos »

well, it looks like thats a different .java than the one i had before, but nonetheless i get the same error.
User avatar
talleyrand
Posts: 624
Joined: Mon Jul 21, 2003 6:56 pm
Location: Kansas City, MO, USA
Contact:

Post by talleyrand »

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.

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.
Post Reply