I'm using Netbeans 8.1, I follow this instruction Packaging and Distributing Java Desktop Applications to build executable file(.jar), but when I double-click to run application, it show error window with a message"Could not find the main class".
Here is configuration of Netbeans use to build .jar file:
Here is contain of manifest file inside .jar file
Inside the .jar file, it also include class in which main class is declared. What else do I need to do to build executable file?
[Edit]
java -jar myfile.jar
jar -tvf myfile.jar
dir lib
Here is diplayImage() function
private String IMG_PATH = "src/images/";
public void displayImage(boolean isOK){
String imgOkFileName = "gateOK.png";
String imgNGFileName = "gateNG.png";
BufferedImage img = null;
if(isOK){
try{
img = ImageIO.read(new File(IMG_PATH+imgOkFileName));
}catch(IOException e){
Logger.getLogger(PTCMainFrame.class.getName()).log(Level.SEVERE, null, e);
}
Image dimg = img.getScaledInstance(lbImage.getWidth(), lbImage.getHeight(),
Image.SCALE_SMOOTH);
ImageIcon image = new ImageIcon(dimg);
if(image == null) lbImage.setText("Image not found");
else{
lbImage.setIcon(image);
}
}else{
try{
img = ImageIO.read(new File(IMG_PATH+imgNGFileName));
}catch(IOException e){
Logger.getLogger(PTCMainFrame.class.getName()).log(Level.SEVERE, null, e);
}
Image dimg = img.getScaledInstance(lbImage.getWidth(), lbImage.getHeight(),
Image.SCALE_SMOOTH);
ImageIcon image = new ImageIcon(dimg);
if(image == null) lbImage.setText("Image not found");
else{
lbImage.setIcon(image);
}
}
}