Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot find symbol errors

 
deepika deepi
Ranch Hand
Posts: 199
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
i am getting an error in this code posted. can any one help me ?


next file class name


Error:
[clrg@localhost check]$ javac Main.java
./AnotherClass.java:5: cannot find symbol
symbol : class User
location: class AnotherClass
public User updateUser(User u)
^
./AnotherClass.java:5: cannot find symbol
symbol : class User
location: class AnotherClass
public User updateUser(User u)
^
Main.java:8: cannot find symbol
symbol : class User
location: class Main
User myUser = new User();
^
Main.java:8: cannot find symbol
symbol : class User
location: class Main
User myUser = new User();
^
4 errors

What am i missing here and why i am getting this error ? Help me . why it is telling it cannot find the symbol?
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where's the class User? The compiler is complaining that it doesn't understand what "User" means. Do you have a class named User?
 
deepika deepi
Ranch Hand
Posts: 199
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
User is the object name and class name is AnotherClass. I tried to work out the code from the link in Java ranch

http://www.coderanch.com/t/492694/java/java/Passing-variables-class-class-SOLVED#2690252

So please i am not sure about it. Please help me how to find the output
 
Matthew Brown
Bartender
Posts: 4549
8
Java Netbeans IDE Scala
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code in that example wasn't complete, because it doesn't show the User class.

User is not the object name in your code. The name is myUser, which is of class User. Since User isn't a built in class, you have to provide it yourself. For that code to work, you need to have a User class with methods getName() and setName(String name).
 
raj warke
Greenhorn
Posts: 11
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Follow the steps mentioned below -

STEP 1 :- Put below files in a folder 'xyz' -
1. Main.java
2. AnotherClass.java
3. User.java
STEP 2 :- Set path variable to -
";drivename:\full_directory_of_xyz_folder\xyz"

Now you can run the program.
 
fred rosenberger
lowercase baba
Bartender
Pie
Posts: 12022
25
Chrome Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
raj warke wrote:
STEP 2 :- Set path variable to -
";drivename:\full_directory_of_xyz_folder\xyz"

Now you can run the program.

Why does he have to set the path variable? The OS can clearly already find the javac.exe program, and one would assume java.exe as well. Neither of those programs reside in the xyz directory (at least, I hope they don't).

I fail to see what this part has to do with anything.

FURTHER, if you set your PATH to ";drivename:\full_directory_of_xyz_folder\xyz", then you will probably break a LOT of other stuff, since the OS won't be able to run things that have been taken OUT of the PATH.

 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic