Hi,
I am getting following message when I am compiling my program on NetBeans 12.3 
on Ubuntu 18.04:
cd /home/zulfi/NetBeansProjects/GUI1; 
JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 
/snap/netbeans/45/netbeans/java/maven/bin/mvn "-Dexec.args=-classpath 
%classpath com.mycompany.gui1.GuiMain" 
-Dexec.executable=/usr/lib/jvm/java-11-openjdk-amd64/bin/java process-classes 
org.codehaus.mojo:exec-maven-plugin:3.0.0:exec
Scanning for projects...

-------------------------< com.mycompany:GUI1 >-------------------------
Building GUI1 1.0-SNAPSHOT
--------------------------------[ jar ]---------------------------------

--- maven-resources-plugin:2.6:resources (default-resources) @ GUI1 ---
Using 'UTF-8' encoding to copy filtered resources.
skip non existing resourceDirectory 
/home/zulfi/NetBeansProjects/GUI1/src/main/resources

--- maven-compiler-plugin:3.1:compile (default-compile) @ GUI1 ---
Changes detected - recompiling the module!
Compiling 1 source file to /home/zulfi/NetBeansProjects/GUI1/target/classes

--- exec-maven-plugin:3.0.0:exec (default-cli) @ GUI1 ---
java.lang.NumberFormatException: For input string: ""
    at 
java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.base/java.lang.Integer.parseInt(Integer.java:662)
    at java.base/java.lang.Integer.parseInt(Integer.java:770)
    at com.mycompany.gui1.GuiMain.main(GuiMain.java:21)
------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time:  4.664 s
Finished at: 2021-05-03T23:25:08-05:00
---------------------------------------------
My program is given below:
package com.mycompany.gui1;
import javax.swing.*;
import java.lang.NumberFormatException;

/**
 *
 * @author zulfi
 */
public class GuiMain {
    public static void main(String[] args){
        final String strFirstNum="";
        final String strSecNum="";
        int val1=0;
        int val2=0;
    try{
        val1 = Integer.parseInt(strSecNum);
        val2 = Integer.parseInt(strFirstNum);
    }catch (NumberFormatException e) {
    e.printStackTrace();}
        int res = val1 + val2;
        JOptionPane.showMessageDialog(null, "Testing Sum = "+ res );
        
    }
    
}


Somebody please guide me.
Zulfi.

Reply via email to