Runnable jar file - PApplet in JPanel
              in 
             Integration and Hardware 
              •  
              2 months ago    
            
 
           
             Hey,
            
I have a main class which contains a jframe (contains public static void main(String[] args)
There is a panel in this jframe which contains the PApplet class.
            
How do I get the runnable jar file to work?
            
I tried using PApplet.main("PAppletclassName"); in the main class which contains the jframe. But it gives me the error: java.lang.RuntimeException: java.lang.InstantiationException
            
Here is how the code works:
            
 
           
 
            
           I have a main class which contains a jframe (contains public static void main(String[] args)
There is a panel in this jframe which contains the PApplet class.
How do I get the runnable jar file to work?
I tried using PApplet.main("PAppletclassName"); in the main class which contains the jframe. But it gives me the error: java.lang.RuntimeException: java.lang.InstantiationException
Here is how the code works:
- public class MainMenu {
public static void main(String[] args) {
PApplet.main("GameEngine");
MainMenu mainMenu = new MainMenu();
}
public MainMenu() {
JPanel enginePanel = new JPanel();
PApplet gameEngine = new GameEngine();
enginePanel.add(gameEngine);
gameEngine.init();
}
} 
- public class GameEngine extends PApplet {
public GameEngine() {
}
} 
 
              
              1  
            
 
            