I have been creating a program that writes and run java classes. So far I have been able to write a "Runable.java" class but not able to run it. I have tried to run a "runjava.bat" and get the .bat to run the "Runable.java" class but I keep getting a "*Error: Could not find or load main class application.Runable.class*". I was wondering what I am doing wrong or if there is a better way to go about running a java class from within a java program?

Here is my code(Simplify Slightly):

**Main.java:**

```
package application;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
import java.util.logging.Level;
import java.util.logging.Logger;

import javafx.application.Platform;
import javafx.stage.FileChooser;

public class Main {
final static String Program =
        "package application;\n"
        + "public class Runable {\n"
        + "public static void main(String[] args) {\n"
        + "System.out.println(\"Hello\");\n"
        + "}\n"
        + "}\n";

public static void main(String[] args) throws IOException {
    Scanner s = new Scanner(System.in);
    while(true){
    System.out.println("State a comand.");
    String Command = s.nextLine();
    if (Command.equalsIgnoreCase("Write") || Command.equalsIgnoreCase("Save")){
         FileChooser fileChooser = new FileChooser();

         //Set extension filter
         FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter("TXT files (*.txt)", "*.txt");
         fileChooser.getExtensionFilters().add(extFilter);

         //Show save file dialog
         File file = new File("src/application/Runable.class");

         if(file != null){
             SaveFile(Program, file);
         }

    }
    else if (Command.equalsIgnoreCase("Run") || Command.equalsIgnoreCase("Play")){
        ProcessBuilder builder = new ProcessBuilder(
                "src/runjava.bat");
            builder.redirectErrorStream(true);
            Process p = builder.start();
            BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
            String line;
            while (true) {
                line = r.readLine();
                if (line == null) { break; }
                System.out.println(line);
            }
    }
    else if (Command.equalsIgnoreCase("End") || Command.equalsIgnoreCase("Exit")){
        Platform.exit();
    }
    else{
        System.err.println("Command not recognized.");
        System.err.println("Please try again.");
    }
    }

}

private static void SaveFile(String content, File file){
    try {
        FileWriter fileWriter = null;

        fileWriter = new FileWriter(file);
        fileWriter.write(content);
        fileWriter.close();
    } catch (IOException ex) {
        Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
    }

}

}

```

**runjava.bat:**

```
javac "src\application\Runable.java"
java application.Runable.class

```

and **Runable.java** if you didn't get it from the Main.java:

```
package application;
public class Runable {
public static void main(String[] args) {
System.out.println("Hello");
}
}

```