1

I am using two different threads to extract a zip file and to display a JProgressBar. My first thread runs properly but second thread gives NullPointerException.

Below is my code to start both threads:-

final String command = System.getProperty("user.dir")+File.separator+"ExtractMe.exe";                
Thread thread1 =  new Thread(){
    public void run() {
        try {
            Runtime.getRuntime().exec("cmd /c "+command);
        } catch (IOException ex) {}                 
    }
};

Thread thread2;
thread2 = new Thread(){
    public void run() {
        new JProgressBarThread();
    }
};    
thread1.start();
thread2.start();

LogCat:-

Exception in thread "Thread-7" java.lang.NullPointerException
    at de.javasoft.plaf.synthetica.SyntheticaRootPaneUI$1.getBorderInsets(SyntheticaRootPaneUI.java:128)
    at de.javasoft.plaf.synthetica.SyntheticaRootPaneUI.installWindowListeners(SyntheticaRootPaneUI.java:147)
    at de.javasoft.plaf.synthetica.SyntheticaRootPaneUI.propertyChange(SyntheticaRootPaneUI.java:273)
    at org.pingalab.splashscr.JProgressBarThread.<init>(Unknown Source)
    at org.pingalab.splashscr.PingalabLauncher$1$2.run(Unknown Source)
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at de.javasoft.plaf.synthetica.SyntheticaRootPaneUI$1.getBorderInsets(SyntheticaRootPaneUI.java:128)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    at java.awt.EventQueue.access$400(EventQueue.java:97)

    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:75)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

And one more question, even if I have used cmd /c to run the exe file for starting extraction, the command window is visible. How can I hide it?

Amit Anand
  • 1,225
  • 1
  • 16
  • 40

0 Answers0