Welcome to the CSC Q&A.
Get help and give help!
Write great code!
It is our choices... that show what we truly are, far more than our abilities.


+34 votes

So I finally got OpenCV and JavaFX to actually work on my laptop in a way that doesn't show any errors. But now, I'm getting an error saying that the compiler cannot find or load a main method. I'm in the MainWindow.java which has the main method that does the launch method. Yet, it can't find it. There are no red X's anywhere in the program, but it says "errors in project Egret, proceed with launch?"

asked in CSC285_Fall2018 by (8 points)

2 Answers

+15 votes
Best answer

Attempt 1: Make sure that you have opened up the correct java file that contains the main(String[] args) method before hitting the green launch button.

Attempt 2: Right click on the project, and do Build Path -> Configure Build Path. Is it missing anything (like the opencv user library?) or wrong Java version (1.8 vs 10?)

Attempt 3: Try doing a Project->Rebuild or Clean. Try looking at Window->Show View->Problems, to see if it gives more information about what's wrong.

Attempt 4: I believe this sometimes happens when you imported the project incorrectly into eclipse.

Try removing the project from Eclipse, and importing again, using this proper method is:

1) Switch to the Git perspective in Eclipse to "add an existing local repository", so that Eclipse knows about EgretRepo.

2) Back in the Java perspective, do "Import" -> "Projects from Git", and browse to your EgretRepo, hit "next" a few times until it finds EgretProject.

Attempt 5 I think this can also happen if you opened the .java file directly from your hard drive, instead of opening it by finding it inside Eclipse and clicking on it there to open it.

answered by (302 points)
selected by

I somehow had two openCV's and both Java 8 and 10. So when I moved those out, I got a blank window which I think is coming from not having scenebuilder installed correctly.

+14 votes

When you hit “launch” what is the error that shows up? Eclipse should show you an error and a little bit further down in the console it should say “caused by:” and that part tells you the error that you are getting.
When you run the program even if it crashes, what is the error that shows in the console? Maybe with that info I could be of more use.

answered by (8 points)

The error literally says: "Error: Could not find or load main class edu.augustana.csc285.Egret.EditingWindow"