This week's giveaway is in the Testing forum.
We're giving away four copies of TDD for a Shopping Website LiveProject and have Steven Solomon on-line!
See this thread for details.
Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

I stopped writing Java in 2014 after a stroke

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am attempting to resume, for my amusement.  38 years of experience means you are too old to get a job.


Eclipse says BarrelMill is already defined.  I have four files total.

The other three

// Constructor of individual pairs of argument names and types

 
Saloon Keeper
Posts: 25463
180
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch, Clayt!

The Code button in our message editor allows you to add Code tags to wrap your source code, XML, and other structured text to make it more readable. I've added them for you here.

I'm not sure what the question you have is, though. About the only thing questionable was that you said that  Eclipse says  is already defined. And if that's true, we'd need a directory listing of your Eclipse project - preferably as text, not a screenshot.
 
Marshal
Posts: 75648
354
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

I am sorry to hear of your misfortunes.
Do you have two BarrelMill classes?
 
Ranch Foreman
Posts: 97
2
IntelliJ IDE Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds kinda like a build environment problem. The kind of that sometimes will "randomly" disappear if you modify the class in question (or rename it), run a manual "clean", restart the IDE, etc. - none of that code is a problem. Randomly vanishing problems are the best! :/ (lol not really)

Try refactoring (renaming) the BarrelMill class to something else using Eclipse's refactor feature, and then rename it back the original name. That may wake the thing up. Unless there really is some other issue (then follow the help given above).
 
Clayt Cramer
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:Welcome to the Ranch, Clayt!

The Code button in our message editor allows you to add Code tags to wrap your source code, XML, and other structured text to make it more readable. I've added them for you here.

I'm not sure what the question you have is, though. About the only thing questionable was that you said that  Eclipse says  is already defined. And if that's true, we'd need a directory listing of your Eclipse project - preferably as text, not a screenshot.



Volume in drive C is Windows
Volume Serial Number is D262-7E0E

Directory of C:\Users\clayt\eclipse-workspace\BarrelMill\src

05/12/2022  06:18 PM    <DIR>          .
05/12/2022  06:18 PM    <DIR>          ..
05/12/2022  11:31 AM               369 ArgTypes.java
05/12/2022  11:26 AM               102 ArgValueTypes.java
05/12/2022  06:12 PM               165 Barrel.java
05/12/2022  06:18 PM                 0 BarrelMill
05/12/2022  06:12 PM               165 BarrelMill.java
05/10/2022  07:57 PM               197 module-info.java
05/12/2022  11:31 AM               173 ParseArgs.java
              7 File(s)          1,171 bytes
              2 Dir(s)  132,872,183,808 bytes free

where BarrelMill is the directory listing.
 
Clayt Cramer
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Lou Hamers wrote:Sounds kinda like a build environment problem. The kind of that sometimes will "randomly" disappear if you modify the class in question (or rename it), run a manual "clean", restart the IDE, etc. - none of that code is a problem. Randomly vanishing problems are the best! :/ (lol not really)

Try refactoring (renaming) the BarrelMill class to something else using Eclipse's refactor feature, and then rename it back the original name. That may wake the thing up. Unless there really is some other issue (then follow the help given above).



I did that did a clean and build all.

No change.
 
Clayt Cramer
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
+

Lou Hamers wrote:Sounds kinda like a build environment problem. The kind of that sometimes will "randomly" disappear if you modify the class in question (or rename it), run a manual "clean", restart the IDE, etc. - none of that code is a problem. Randomly vanishing problems are the best! :/ (lol not really)

Try refactoring (renaming) the BarrelMill class to something else using Eclipse's refactor feature, and then rename it back the original name. That may wake the thing up. Unless there really is some other issue (then follow the help given above).



I removed BarrelMill.java from the directory, and created a new class

Error unchanged.  Even though I detached BarrelMill, it was still in the directory from the command line, so I deleted it, clean buuild all and now all is well.
 
Clayt Cramer
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Clayt Cramer wrote:

Lou Hamers wrote:Sounds kinda like a build environment problem. The kind of that sometimes will "randomly" disappear if you modify the class in question (or rename it), run a manual "clean", restart the IDE, etc. - none of that code is a problem. Randomly vanishing problems are the best! :/ (lol not really)

Try refactoring (renaming) the BarrelMill class to something else using Eclipse's refactor feature, and then rename it back the original name. That may wake the thing up. Unless there really is some other issue (then follow the help given above).



I did that did a clean and build all.

No change.

It appears that once BarrelMill is defined there is no way to delete it from Eclipse so creating a class BarrelMill (even from scratch) still sees the old definition.
 
Clayt Cramer
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Clayt Cramer wrote:

Clayt Cramer wrote:

Lou Hamers wrote:Sounds kinda like a build environment problem. The kind of that sometimes will "randomly" disappear if you modify the class in question (or rename it), run a manual "clean", restart the IDE, etc. - none of that code is a problem. Randomly vanishing problems are the best! :/ (lol not really)

Try refactoring (renaming) the BarrelMill class to something else using Eclipse's refactor feature, and then rename it back the original name. That may wake the thing up. Unless there really is some other issue (then follow the help given above).



I did that did a clean and build all.

No change.

It appears that once BarrelMill is defined there is no way to delete it from Eclipse so creating a class BarrelMill (even from scratch) still sees the old definition.


Weirder and weirder.  I deleted BarrelMill.java from the cmd line and created a new class.


Error: Main method is not static in class BarrelMill, please define the main method as:
  public static void main(String[] args)
 
Clayt Cramer
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Clayt Cramer wrote:

Clayt Cramer wrote:

Clayt Cramer wrote:

Lou Hamers wrote:Sounds kinda like a build environment problem. The kind of that sometimes will "randomly" disappear if you modify the class in question (or rename it), run a manual "clean", restart the IDE, etc. - none of that code is a problem. Randomly vanishing problems are the best! :/ (lol not really)

Try refactoring (renaming) the BarrelMill class to something else using Eclipse's refactor feature, and then rename it back the original name. That may wake the thing up. Unless there really is some other issue (then follow the help given above).



I did that did a clean and build all.

No change.

It appears that once BarrelMill is defined there is no way to delete it from Eclipse so creating a class BarrelMill (even from scratch) still sees the old definition.


Weirder and weirder.  I deleted BarrelMill.java from the cmd line and created a new class.


Error: Main method is not static in class BarrelMill, please define the main method as:
  public static void main(String[] args)


I removed BarrelMill.java again both in Eclipse and cmd, created an identical class Barrel and it works.  I think clean does not work as it should.
 
Saloon Keeper
Posts: 9267
78
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After you make a change using cmd line, do you go back to Eclipse and click on Refresh ?
 
Lou Hamers
Ranch Foreman
Posts: 97
2
IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So the file was "deleted" but still showed up on a command line? (I wonder what a file system explorer would've shown is in there.)

This could be a long shot but I wonder if there was/is some file system corruption or bug. (I've seen that kind of garbage before a few times with Windows when I'm forced to use it. No clue how it happens, I feel like it was related to Java doing file deletions though.)

Eclipse being out of sync and needing a refresh would not be the strangest thing.

I'd probably wipe out the project build directory (Is that what Eclipse uses? It's been years since I've used it.) and make it re-build everything, if I were seeing this kind of stuff. Or maybe even make a new "project" and move the source into that just to be sure things are cleaned up. Being paranoid I might reboot the OS too, haha. (The "Did you try turning the power off and back on again?" joke...)
 
Tim Holloway
Saloon Keeper
Posts: 25463
180
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It would have helped to have a tree listing of the entire BarrelMill project directory. There may be skunks in the woodpile that we can't see here.

I'm curious why there appears to be a zero-length file named BarrelMill in the BarrelMill\src directory, though.
 
Clayt Cramer
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Tim Holloway wrote:It would have helped to have a tree listing of the entire BarrelMill project directory. There may be skunks in the woodpile that we can't see here.

I'm curious why there appears to be a zero-length file named BarrelMill in the BarrelMill\src directory, though.


BarrelMill was the result of "dir >BarrelMill" so the file was created before the DIR command ran.
 
Tim Holloway
Saloon Keeper
Posts: 25463
180
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Clayt Cramer wrote:

Tim Holloway wrote:It would have helped to have a tree listing of the entire BarrelMill project directory. There may be skunks in the woodpile that we can't see here.

I'm curious why there appears to be a zero-length file named BarrelMill in the BarrelMill\src directory, though.


BarrelMill was the result of "dir >BarrelMill" so the file was created before the DIR command ran.



Ah. I am enlightened.

I have not lived in the Windows world for a long time now, but I believe that you can get a tree listing of a directory using the "/T" switch on the DIR command.
 
Carey Brown
Saloon Keeper
Posts: 9267
78
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To get list of options:
help dir

dir /s
to recursively list subdirectories
 
Carey Brown
Saloon Keeper
Posts: 9267
78
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Clayt Cramer wrote:BarrelMill was the result of "dir >BarrelMill"

I typically add a ".txt" to the end of a file like that. Eliminates confusion and lets Windows know how to open it if you double click on it.
 
Carey Brown
Saloon Keeper
Posts: 9267
78
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can also get a list of options with:
dir /?

the "/?" works for most Microsoft command line programs.
 
Carey Brown
Saloon Keeper
Posts: 9267
78
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are going to run Eclipse with Java 17 I suggest upgrading Eclipse to 2022-03.

To kick Eclipse when a project seems corrupted:
Save all files in Eclipse
Right click on project and select Delete. Make sure that "delete contents on disk" is NOT checked.
Right click on background in left margin and select Import>Install>From Existing Installation
Choose your project directory on disk.
Do a Project>Clean

Usually that fixes things for me.
 
Tim Holloway
Saloon Keeper
Posts: 25463
180
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Before resulting to such extremes, I would like to see a full directory listing of the project directory.

Eclipse is not that unstable, nor are projects defined to Eclipse. Granted, if you don't know what you're doing, you can get some really gnarly project options in effect, but I know of only one way to get the "predefined class" message from a mis-configured project and I need that directory listing before looking in that direction.

I would recommend upgrading Eclipse to ensure support for the latest JVM versions, but that can be done without destroying projects. Eclipse may upgrade the project workspace in a one-way direction, but the project workspace and the projects themselves are two different things - projects don't actually even have to live in the workspace directory. The workspace contains general Eclipse metadata including what projects are defined for that workspace and where their directories are. The project itself is primarily ordinary files, plus the .project file that defines the project, the .classpath file for Java project class location (this is one that we'd want to look at if the directory doesn't tell me directly what's wrong), and sometimes some additional meta-information.

So, in short:

1. Please provide a directory listing of the entire project tree
2. Consider upgrading Eclipse
3. ???
4. Profit!
 
I yam what I yam and that's all that I yam - the great philosopher Popeye. Tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic