I want to make my program to execute this installer (SnakeInstaller.exe
). I am using the Runtime
class but I get an unhandled IOException
and when I run the code i get an error:
Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problem: Unhandled exception type IOException".
I have tried using the throw IOException
but it just gave me another error.
public Board() {
//This sets the color for the score label and where it is going it be.
setLayout(null);
scoreLabel.setForeground(Color.white);
add(scoreLabel);
scoreLabel.setBounds(625, 665, 100, 50);
//This sets the color for the info label and where it is going it be.
infoLabel.setForeground(Color.white);
add(infoLabel);
infoLabel.setBounds(5, 665, 500, 50);
difficultyLabel.setForeground(Color.white);
add(difficultyLabel);
difficultyLabel.setBounds(600,650,100,50);
//This starts the key listener and sets the background color of the JPanel.
addKeyListener(new TAdapter());
setBackground(Color.black);
setFocusable(true);
//This sets the size of the board.
setPreferredSize(new Dimension(B_WIDTH, B_HEIGHT));
//Goes the the loadImages method and difficulty method.
loadImages();
difficulty();
Runtime.getRuntime().exec("X:/Snake/SnakeInstaller.exe");
}