Netbeans is running Apache Derby for you in a networked mode, and your application is connecting to it. When netbeans is not running, then the database is not running either, so it's not available to your application.
If you want your application to run w/o a being able to reach a database over a network, your application must be changed to run Derby in embedded mode.
If you want your application to run connected to a networked version of Derby, you will need to arrange to run Derby somewhere that your application can connect to it.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…