I've tried different java version, installed the engine folder in different places. The only error constantly popping is related to the main class. The main class can't be found. Although the class SnakeGame is the right path and all the instructions provided were carefully followed, the main class related error is the only one I don't know how to fix. Cheers!
can't compile
Resolved
Comments (5)
- Popular
- New
- Old
You must be signed in to leave a comment
Emil Valentin Toma
15 July 2019, 12:29solution
Thanks for reply Ewerton. I did that too, before your kind reminder. Lately I made some progress though. After building it I can see the red console and the screen. I'm still haunted by an "Unknown error" while trying to verify the task but I'll verify it on the website anyway. The fix for this post was to fall back to Java10 and change the location of working directory to $MODULE_WORKING_DIR$
Also is worth mentioning that when JavaFX is to be deployed, the whole folder of javafx must be selected, not only the libraries. This is working for me for now. Thanks to everyone for their time looking into my problem.
+2
Ewerton Backend Developer
12 July 2019, 15:58
If you are on lesson 1, you didn't specify the screen size yet, so you can't run the game. Just do what is asked and verify your task.
For the other lessons, just run the game on the web, if you use an IDE, use that only to create the code.
0
Emil Valentin Toma
12 July 2019, 12:29
in the meantime I played a bit more with it, different error:
Exception in thread "main" java.lang.NoSuchMethodException: com.codegym.games.snake.SnakeGame.main([Ljava.lang.String;)
at java.base/java.lang.Class.getMethod(Class.java:2114)
at com.intellij.uiDesigner.snapShooter.SnapShooter.main(SnapShooter.java:56)
0
Emil Valentin Toma
12 July 2019, 12:21
yeap.
![]()
loaded:
"C:\Program Files\Java\jdk-12.0.1\bin\java.exe"
C:\CodeGymTasks\CodeGymTasks\8.Games\lib\javafx-sdk-11.0.2\lib -javaagent:C:\Users\Emil\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-0\183.5153.38\lib\idea_rt.jar=50906:C:\Users\Emil\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-0\183.5153.38\bin -Dfile.encoding=UTF-8 -classpath C:\CodeGymTasks\CodeGymTasks\out\production\8.Games;
C:\CodeGymTasks\CodeGymTasks\8.Games\lib\javafx-sdk-11.0.2\lib\src.zip;
...\8.Games\lib\javafx-sdk-11.0.2\lib\javafx-swt.jar;
...\8.Games\lib\javafx-sdk-11.0.2\lib\javafx.web.jar;
...\8.Games\lib\javafx-sdk-11.0.2\lib\javafx.base.jar;
...\8.Games\lib\javafx-sdk-11.0.2\lib\javafx.fxml.jar;
...\8.Games\lib\javafx-sdk-11.0.2\lib\javafx.media.jar;
...\8.Games\lib\javafx-sdk-11.0.2\lib\javafx.swing.jar;
...\8.Games\lib\javafx-sdk-11.0.2\lib\javafx.controls.jar;
...\8.Games\lib\javafx-sdk-11.0.2\lib\javafx.graphics.jar;
...\8.Games\lib\desktop-game-engine.jar;
...\8.Games\lib\openjfx-11.0.2_windows-x64_bin-sdk.zip com.codegym.games.snake.SnakeGame
Error: Could not find or load main class C:\CodeGymTasks\CodeGymTasks\8.Games\lib\javafx-sdk-11.0.2\lib
Caused by: java.lang.ClassNotFoundException: C:\CodeGymTasks\CodeGymTasks\8.Games\lib\javafx-sdk-11.0.2\lib
Process finished with exit code 1

0
DS
12 July 2019, 11:06
Did you create class SnakeGame or file?
0