• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Suddenly Cannot Find Classes

 
Ranch Hand
Posts: 377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know if this is an Eclipse problem or something I inadvertently did but my main GUI JFrame suddenly stopped recognizing all my classes except for a JMenuBar.

Can someone spot what I may have messed up? Oddly, other uses of these classes elsewhere all seem to be fine, which in my mind implies perhaps a syntax problem somewhere in this particular file. TIA.
 
Saloon Keeper
Posts: 15510
363
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So what error message do you get when you compile it?
 
Dennis Putnam
Ranch Hand
Posts: 377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Eclipse doesn't let me compile it because of these errors. The Eclipse error says: "<class name> cannot be resolved".
 
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What's the first line that gives you that error, and for what class (if it's not obvious)?
 
Dennis Putnam
Ranch Hand
Posts: 377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The first one is 17. The others are 68, 69, 70, 72 and 76.
 
Dave Tolls
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So these are your classes.
OK.
What packages are they in?

Let's start with the top one, ParseStokerClass.
Where is that in relation to your GUI class (which I note is not in a package, something you may want to correct).
 
Dennis Putnam
Ranch Hand
Posts: 377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
They are all in the single package StokerMonitor. I don't really understand the significance of a 'Package' but that was created by my IDE when I started the project.
 
Stephan van Hulst
Saloon Keeper
Posts: 15510
363
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's no package declaration at the top of your source file.
 
Dennis Putnam
Ranch Hand
Posts: 377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I didn't capture that in my copy/paste. This is the first line of each file:
 
Stephan van Hulst
Saloon Keeper
Posts: 15510
363
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you tried restarting Eclipse, or compiling your classes manually?
 
Dave Tolls
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So, are those line numbers you gave for the code above, or the code as it appears in the IDE (with the package line)?
 
Dennis Putnam
Ranch Hand
Posts: 377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Restarting Eclipse was the first thing I tried followed by a reboot. I don't know how to compile manually in Eclipse.
 
Dennis Putnam
Ranch Hand
Posts: 377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Dave Tolls wrote:So, are those line numbers you gave for the code above, or the code as it appears in the IDE (with the package line)?

In the code above.
 
Stephan van Hulst
Saloon Keeper
Posts: 15510
363
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By compiling manually I mean using javac on the command line.

If you don't know how to do this, I suggest looking up a 'getting started' guide somewhere, because this is an essential skill to have.
 
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try pressing F5 or refresh the project.
 
Knute Snortum
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In your Project Explorer, click on your project name, then on the package StokerMonitor. Do you see the ParseStokerClass file?
 
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You haven't recently upgraded your Java® installation and uninstalled the previous version, have you?
 
Dennis Putnam
Ranch Hand
Posts: 377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is the attached what you mean?
screenshot.jpg
[Thumbnail for screenshot.jpg]
 
Dave Tolls
Rancher
Posts: 4801
50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Doesn't Eclipse mark files that have a compilation issue with a red mark in that view?
It's been a couple of years since I used it so I can't remember.
 
Knute Snortum
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Dennis Putnam: Yes, that's it. Weird, I can see the ParseStokerClass in your package. Did you try F5?

@Dave Tolls: Yes, there would be a red "x" on the classes that don't compile. This is strange because I don't see any red exes.
 
Knute Snortum
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I notice you have Git on the project. You didn't accidentally checkout a branch without some of the classes, did you?
 
Dennis Putnam
Ranch Hand
Posts: 377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, there would be red flags on the classes containing errors. Sorry for the confusion but I've commented out the erroneous lines so I could continue work on other parts. If uncommented, GUI.java would have the flag.
 
Dennis Putnam
Ranch Hand
Posts: 377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Knute Snortum wrote:I notice you have Git on the project. You didn't accidentally checkout a branch without some of the classes, did you?

No, there is only the master branch at this time.
 
Stephan van Hulst
Saloon Keeper
Posts: 15510
363
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Again, in order to figure out if this is an actual compilation error or Eclipse being absent-minded, you need to compile your application through the command line, and report what happens.

From your "Stoker Monitor" project, you can try running the following line: javac -sourcepath src;resources -d classes src/StokerMonitor/GUI.java
 
Dennis Putnam
Ranch Hand
Posts: 377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Arrrggghhhh!!! It compiled fine using javac. It must have been Eclipse losing its marbles. After the manual compile, Eclipse was happy again. I have no clue what happened. Sorry for all the trouble but thanks for all the help.
 
Stephan van Hulst
Saloon Keeper
Posts: 15510
363
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Eclipse probably used some cached version of your compiled classes. For most IDE's when you encounter weird errors, doing a project clean and rebuild fixes it. Sometimes deleting the compiled classes from your project folder is enough to fix the issue.
 
Knute Snortum
Sheriff
Posts: 7125
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Under the Project menu, do you have Build Automatically checked? If not, you have to build (compile) the project manually.
reply
    Bookmark Topic Watch Topic
  • New Topic