Howard007
Howard007

Reputation: 124

Eclipse doesn't compile class to bin directory

advanced Java programmer, newbie to Eclipse (Oxygen.1a Release (4.7.1a)) here. When I try to run my Java console app [invoking main()], Eclipse doesn't seem to compile the current java file in my editor and copy the class file to the bin directory. Instead, it just runs the same old class file that is already in the bin directory, or if it's not there, complains that "Error: Could not find or load main class MyPackageA.MyClassA". It worked only once, the first time when I created the project and imported the files. I can edit the java file in a text editor, compile and run it at the command line OK (away from Eclipse). I can even copy the class file(s) to Eclipse's bin directory and 'run' the corresponding java file that's in my Eclipse editor. But it's not the java file that's in my Eclipse editor that is running, nor is it a class file compiled from that java file; it's the class file of the same name that I compiled and copied to the Eclipse bin from elsewhere. Tutorials and YouTube videos that I have found only seem to show the "happy path" where everything works as one my expect.
Please advise. Project screenshot

Upvotes: 2

Views: 1539

Answers (1)

Howard007
Howard007

Reputation: 124

I ran Project->Clean... on the project and now it is working; compiles and copies/deploys to the bin directory, executes as expected. It still gives me an error dialog before executing: "Errors exist in required projects...Proceed with launch?" That doesn't seem to affect the outcome, but I'm worried there be more problems lurking in the shadows. Thanks to All for your help!

Upvotes: 1

Related Questions