//This is the default code VSC creates for a javafx file.
//It is giving an error message of "Error: Main method not found in the file,
//please define the main method as: public static void main(String[] args)"
package com.example;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import java.io.IOException;
/**
 * JavaFX App
 */
public class App extends Application {
     private static Scene scene;
     @Override
     public void start(Stage stage) throws IOException {
        scene = new Scene(loadFXML("primary"), 640, 480);
        stage.setScene(scene);
        stage.show();
     }
     static void setRoot(String fxml) throws IOException {
         scene.setRoot(loadFXML(fxml));
     }
     private static Parent loadFXML(String fxml) throws IOException {
         FXMLLoader fxmlLoader = new FXMLLoader(App.class.getResource(fxml + ".fxml"));
         return fxmlLoader.load();
     }
     public static void main(String[] args) {
         launch();
     }
}
My java projects suddenly stopped working in Virtual Studio Code. I started a new javafx project and tried to run it, but it's giving me an error saying that there is no main method, even though I have a correctly defined main method. I tried running a default javafx program that VSC creates, and even their own project didn't run, giving the same error. I am also getting an error that pom.xml needs to be updated, but I tried to update it and it didn't help. What am I missing or how can I fix this? I have an internet filter which I thought might be causing problems, but I have run java projects in VSC since getting the filter, and I specifically had them allow http://plugins.gradle.org, http://oracle.com, and maven.apache.org.
In the pom.xml file, I changed the version number under to the latest version number. I tried closing and restarting the project and running maven clean install and maven clean in the terminal.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
      <groupId>com.example</groupId>
      <artifactId>demo</artifactId>
      <version>1.0-SNAPSHOT</version>
      <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <maven.compiler.source>11</maven.compiler.source>
         <maven.compiler.target>11</maven.compiler.target>
      </properties>
      <dependencies>
         <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>13</version>
         </dependency>
         <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-fxml</artifactId>
            <version>13</version>
         </dependency>
      </dependencies>
      <!-- ... -->
</project>