aspose file tools*
The moose likes Beginning Java and the fly likes I keep get a  resolved to a variable error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "I keep get a  resolved to a variable error " Watch "I keep get a  resolved to a variable error " New topic
Author

I keep get a resolved to a variable error

Glen Lacock
Greenhorn

Joined: Apr 18, 2011
Posts: 1
He is the error I am geting
and help would be great.
thank you

Exception in thread "main" java.lang.Error: Unresolved compilation problem:
rate1 cannot be resolved to a variable

at javax.awt.event.glenhomeMortgage.init(glenhomeMortgage.java:76)
at javax.awt.event.glenhomeMortgage.main(glenhomeMortgage.java:148)

fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11480
    
  16

rate1 is declared inside the try-block between lines 32-58. So when you leave the try, it falls out of scope, and therefore doesn't exist when you get to line 76.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39885
    
  28
Welcome to the Ranch

Don't run anything from your IDE until all the compilation errors have been sorted. The error messages from the IDE are usually more helpful than the runtime errors.
Not being able to find rate1 might mean you have spelt it differently; even the tiniest error will throw the compiler. If you declared it as Rate1 and try to use it as rate1, it cannot be found. By the way: rate1 with a small r is correct.
Another possibility is that you are dealing with a local variable; if you are outwith the {} pair rate1 was declared in, it will be out of scope and inaccessible.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14352
    
  22

Welcome to the Ranch, Glen!
Glen Lacock wrote:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
rate1 cannot be resolved to a variable

This is a strange kind of error to get - it might mean that some of your compiled class files are out-of-sync with your source code files.

Try to delete all your *.class files and re-compile all your source files again; or if you're using an IDE, try "rebuild all" to make it re-compile all your source files.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39885
    
  28
Only rob is allowed to beat my by 1 minute, Fred
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11480
    
  16

Campbell Ritchie wrote:Only rob is allowed to beat my by 1 minute, Fred

1 minute, 3 seconds!!!
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39885
    
  28
fred rosenberger wrote:1 minute, 3 seconds!!!
Rob would have managed 0 minutes 3 seconds
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I keep get a resolved to a variable error