Some problems to which these are solutions. 1. "Error: Could not find or load main class app Caused by: java.lang.ClassNotFoundException: app" Solution: When u click the run button , VS code gives a warning, "The file app.java isn't on the classpath, the runtime may throw class not found error. Do you want to add the parent folder "APP/JavaFx Application/src" to Java source path?" Click yes. This warning is show only if you have installed "Debugger for Java" extension. If this warning is not shown by your VS code, then you can paste the below code in your settings.json, where you find the location of your jar files that you import. ``` "java.project.sourcePaths": [ "JavaFx Application/src" ] ``` If you have any other projects to add under this project, you can update this list accordingly. 2. After this you might me seeing one more error. "Error: JavaFX runtime components are missing, and are required to run this application" Solution: Fist, Debug your application's code. Can be done by "create a launch.json file" under "RUNAND DEBUG" of Explorer section. Add this vmArgs to the configuration which has the projectName in it. ``` "vmArgs": "--module-path D:\\Java_JFX\\javafx-sdk-14.0.2.1\\lib --add-modules javafx.controls,javafx.fxml", ``` It should be the path to the JavaFX lib folder. Then it will work. 👌✨ like anything !!
@user-pd4wz1oo3x2 жыл бұрын
thank you!!!! it worked :D
@picnicbros2 жыл бұрын
Works like a charm, thank you!
@harshith_takkala4 жыл бұрын
Like the video if you find it useful. Cheers !!😀✌👍
@shoyur2 жыл бұрын
If i move the project to another folder, it creates another object in the launch.js, this new object doesnt have the vmargs so i get the error again, do you know why please ? thx
@harshith_takkala2 жыл бұрын
Yeah This is the problem I too faced. I dont know why. I just copy pasted the same key value pair in the newly created object.
@gouthamreddy42754 жыл бұрын
This video changed my whole life THANK U
@harshith_takkala4 жыл бұрын
😅😅
@badabeta69733 жыл бұрын
I'm having a problem running the program -> Error: Could not find or load main class javafx.controls, javafx.fxml Caused by: java.lang.ClassNotFoundException: javafx.controls, javafx.fxml Iam facing this problem can you help with it !!!!!!!
@harshith_takkala3 жыл бұрын
Hey, You must run the program with "Java code runner" but not with "code runner"(basically used for all programs but not for projects). ✌
@harshith_takkala3 жыл бұрын
Hey, sorry for late reply but now I understood your problem. 1. "Error: Could not find or load main class app Caused by: java.lang.ClassNotFoundException: app" Solution: When u click the run button , VS code gives a warning, "The file app.java isn't on the classpath, the runtime may throw class not found error. Do you want to add the parent folder "APP/JavaFx Application/src" to Java source path?" Click yes. This warning is show only if you have installed "Debugger for Java" extension. If this warning is not shown by your VS code, then you can paste the below code in your settings.json, where you find the location of your jar files that you import. ``` "java.project.sourcePaths": [ "JavaFx Application/src" ] ``` If you have any other projects to add under this project, you can update this list accordingly. 2. After this you might me seeing one more error. "Error: JavaFX runtime components are missing, and are required to run this application" Solution: Fist, Debug your application's code. Can be done by "create a launch.json file" under "RUNAND DEBUG" of Explorer section. Add this vmArgs to the configuration which has the projectName in it. ``` "vmArgs": "--module-path D:\\Java_JFX\\javafx-sdk-14.0.2.1\\lib --add-modules javafx.controls,javafx.fxml", ``` It should be the path to the JavaFX lib folder. Then it will work. 👌✨ like anything !!
@ctx42412 жыл бұрын
Aaaaand obligatory question... do you know how to make runnable jar out of it?
@harshith_takkala2 жыл бұрын
Yes. Make a java project (follow the video for servlet development, and then instead of those dependencies, search for javafx dependencies in central maven repository) Then after all programming part, you can use "mvn war" command to create a war package. Hope you got it
@ctx42412 жыл бұрын
@@harshith_takkala no, you are making video about VSC, no build tools, javaFX. Can you export runnable jar from JavaFX project in VSC, no build tools?
@harshith_takkala2 жыл бұрын
@@ctx4241 only with the help of vscode, we cannot do it. Only with maven as build tool, we can do it
@matheusvinicius14204 жыл бұрын
I'm having a problem running the program -> Error: Could not find or load main class javafx.controls, javafx.fxml Caused by: java.lang.ClassNotFoundException: javafx.controls, javafx.fxml Would you help me out of this?
@harshith_takkala4 жыл бұрын
Hey! I am not getting any error of this kind. May be: 1. Restart the whole procedure again, (backup the code required). 2. Check out my previous video on the same topic for initial installations and others. 3. Make sure all jar files are imported under referenced libraries section 4. Type the correct value for vmArgs in json file 5. I took reference from this: stackoverflow.com/questions/54349894/javafx-11-with-vscode Hope you got it !! This is my launch.json file { // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "type": "java", "name": "Debug (Launch) - Current File", "request": "launch", "mainClass": "${file}" }, { "type": "java", "name": "Debug (Launch)-App", "request": "launch", "mainClass": "App", "vmArgs": "--module-path --add-modules javafx.controls,javafx.fxml", "projectName": "application_6f235254" } ] }
@0x5c4 жыл бұрын
I know its been a month since this was posted but you should do "vmArgs": "--module-path \"\" --add-modules javafx.controls,javafx.fxml"
@harshith_takkala4 жыл бұрын
@@0x5c yes you are right !
@badabeta69733 жыл бұрын
even Iam facing the same issue ! can anyone respond
@harshith_takkala3 жыл бұрын
Hey, sorry for late reply but now I understood your problem. 1. "Error: Could not find or load main class app Caused by: java.lang.ClassNotFoundException: app" Solution: When u click the run button , VS code gives a warning, "The file app.java isn't on the classpath, the runtime may throw class not found error. Do you want to add the parent folder "APP/JavaFx Application/src" to Java source path?" Click yes. This warning is show only if you have installed "Debugger for Java" extension. If this warning is not shown by your VS code, then you can paste the below code in your settings.json, where you find the location of your jar files that you import. ``` "java.project.sourcePaths": [ "JavaFx Application/src" ] ``` If you have any other projects to add under this project, you can update this list accordingly. 2. After this you might me seeing one more error. "Error: JavaFX runtime components are missing, and are required to run this application" Solution: Fist, Debug your application's code. Can be done by "create a launch.json file" under "RUNAND DEBUG" of Explorer section. Add this vmArgs to the configuration which has the projectName in it. ``` "vmArgs": "--module-path D:\\Java_JFX\\javafx-sdk-14.0.2.1\\lib --add-modules javafx.controls,javafx.fxml", ``` It should be the path to the JavaFX lib folder. Then it will work. 👌✨ like anything !!
@hussanwaheed213 жыл бұрын
i'm still getting the Error: JavaFX runtime components are missing, and are required to run this application error
@harshith_takkala3 жыл бұрын
Yeah, please check the pinned comment✌
@hussanwaheed213 жыл бұрын
@@harshith_takkala Yeah fixed it in a jiffy. i just had a major brain fart and was launching the wrong debug config.
@harshith_takkala3 жыл бұрын
@@hussanwaheed21 oh cool then.
@ganumba114 жыл бұрын
Thank you, this worked.
@hellenfernandes80934 жыл бұрын
Does it work for mac? "vmArgs": "--module-path D:\\Java_JFX\\javafx-sdk-14.0.2.1\\lib --add-modules javafx.controls,javafx.fxml",
@harshith_takkala4 жыл бұрын
I too have no idea. But I think the code snippet is based on VS code editor software but not based on OS. So I guess it might work..
@hellenfernandes80934 жыл бұрын
Yeah, it doesnt wotk. I dont know what to do. Can you help me?
@harshith_takkala4 жыл бұрын
@@hellenfernandes8093 I also dont know, but I have followed in the similar way as described in the stackoverflow website. The screenshots were also taken from macbook. Link in description.
@harshith_takkala4 жыл бұрын
@@hellenfernandes8093 hey did u get it...?
@vicente3j2 жыл бұрын
Quick note on mac you use the "/" instead of "\\" otherwise good video, that error had me stuck for a while though
@datdat094 жыл бұрын
Thank you for your video, I am struggling with this. I followed your instruction; however, I still cannot run directly on vsc, I added vmArgs exactly as the instruction, but my terminal showed different from yours. It seems longer, shows every jars file in that lib, It also return one error "Could not find or load main class Files.AdoptOpenJDK.javafx-sdk-11.0.2.lib Caused by: java.lang.ClassNotFoundException: Files.AdoptOpenJDK.javafx-sdk-11.0.2.lib". I googled it but didn't find any answer, could you please help me with this? Really appreciate your efford. Thank you.
@harshith_takkala4 жыл бұрын
I think this might work(not sure) 1. Remove the lines 7 to 12 in launch.json and try again to run it. 2. Replace the word "Debug" in launch.jason with "CodeLens" in launch.json and try again to run. 3. I don't know what is AdoptOpenJDK. I have used Oracle JDK. I think this might help: adoptopenjdk.net/migration.html 4. I doubt you might have installed javafx separately in the system. "With the release of JDK 11 in 2018, Oracle has madeJavaFX part of the OpenJDK under the OpenJFX project." So according to this statement from wiki, installing separately again in yours(while using OpenJDK) might produce errors. This might also be helpful: stackoverflow.com/questions/18547362/javafx-and-openjdk developer.okta.com/blog/2019/01/16/which-java-sdk If nothing works, then I dont know because I am hearing AdoptOpenJDK word for the first time.😅 Thanks for the appreciation 🤝
@harshith_takkala3 жыл бұрын
Hey, sorry for late reply but now I understood your problem. 1. "Error: Could not find or load main class app Caused by: java.lang.ClassNotFoundException: app" Solution: When u click the run button , VS code gives a warning, "The file app.java isn't on the classpath, the runtime may throw class not found error. Do you want to add the parent folder "APP/JavaFx Application/src" to Java source path?" Click yes. This warning is show only if you have installed "Debugger for Java" extension. If this warning is not shown by your VS code, then you can paste the below code in your settings.json, where you find the location of your jar files that you import. ``` "java.project.sourcePaths": [ "JavaFx Application/src" ] ``` If you have any other projects to add under this project, you can update this list accordingly. 2. After this you might me seeing one more error. "Error: JavaFX runtime components are missing, and are required to run this application" Solution: Fist, Debug your application's code. Can be done by "create a launch.json file" under "RUNAND DEBUG" of Explorer section. Add this vmArgs to the configuration which has the projectName in it. ``` "vmArgs": "--module-path D:\\Java_JFX\\javafx-sdk-14.0.2.1\\lib --add-modules javafx.controls,javafx.fxml", ``` It should be the path to the JavaFX lib folder. Then it will work. 👌✨ like anything !!
@datdat093 жыл бұрын
@@harshith_takkala haha ty, i deleted jdk, it was just for my project on university. But hope this cmt could help sone encounters the same prob. Anw, thank for your video.
@harshith_takkala3 жыл бұрын
@@datdat09 I too had assignment for the university. Many of my frds use eclipse or intellij. So I thought of doing like this.😁😄
@faizaaftab98133 жыл бұрын
I am getting 20 errors ☹️☹️☹️
@harshith_takkala3 жыл бұрын
Ok, explain in brief plz
@cerant64233 жыл бұрын
no me funciono
@harshith_takkala3 жыл бұрын
oh, lo siento por eso. Puedes ver mi otro video para el mismo, que es muy efectivo para compilar y ejecutar.
@harshith_takkala3 жыл бұрын
kzbin.info/www/bejne/i6uzd5-miNd6f5o This one
@harshith_takkala3 жыл бұрын
Hey, sorry for late reply but now I understood your problem. 1. "Error: Could not find or load main class app Caused by: java.lang.ClassNotFoundException: app" Solution: When u click the run button , VS code gives a warning, "The file app.java isn't on the classpath, the runtime may throw class not found error. Do you want to add the parent folder "APP/JavaFx Application/src" to Java source path?" Click yes. This warning is show only if you have installed "Debugger for Java" extension. If this warning is not shown by your VS code, then you can paste the below code in your settings.json, where you find the location of your jar files that you import. ``` "java.project.sourcePaths": [ "JavaFx Application/src" ] ``` If you have any other projects to add under this project, you can update this list accordingly. 2. After this you might me seeing one more error. "Error: JavaFX runtime components are missing, and are required to run this application" Solution: Fist, Debug your application's code. Can be done by "create a launch.json file" under "RUNAND DEBUG" of Explorer section. Add this vmArgs to the configuration which has the projectName in it. ``` "vmArgs": "--module-path D:\\Java_JFX\\javafx-sdk-14.0.2.1\\lib --add-modules javafx.controls,javafx.fxml", ``` It should be the path to the JavaFX lib folder. Then it will work. 👌✨ like anything !!