Hello,
I have an app that runs good in the NETBEANS ide. When I run it as a stanalone exec.jar and place the executable in the project folder or when I place the executable on the thumb drive it runs with anomolies.
When I run the app from a thumb drive it will not throw my exceptions
I am using Netbeans ide.
It will create the frame.ser and save it in my dir and it will write my XML properly but it will not do both. If it actually writes my XML it will stop before it adds the default close operation "X" in the upper right corner.
When running the app from the thumb drive it does not complete the JInternalFrame and it reads the frame.ser yet it will not open. I must be encountering a loadXMLResource problem.

What is it about a standalone exec .jar using dependencies that does not want to properly serialize a JInternalFrame to a dir on the thumb drive and open it?
My app is using the variable:

public static final String USERDIRDIR = System.getProperty("user.dir", ".");

and the XML.xml file is in the userdir at:

public static final String XMLRESOURCES = "xml/ModelResourcesXML.xml";

I also use a properties sheet

RESOURCES = ModelUtils.class.getPackage().getName()
            + ".resources.ModelResources";public static final String USERDIRDIR = System.getProperty("user.dir", ".");

and the XML.xml file is in the userdir at:

public static final String XMLRESOURCES = "xml/ModelResourcesXML.xml";

As I mentioned. When I run the app as a standalone on the thumb drive. It will not throw any of my exceptions: exeception example to follow.

thanks

SerializeFrame() throws FileNotFoundException, ProfileException, LoginException, SQLException, javax.security.auth.login.LoginException, ClassNotFoundException, InstantiationException, IllegalAccessException {

        String M = (" --> in  public SerializeFrame() var: xxxxxxxxx : xxxxxxxx<-- \n");
        System.out.println(M);
    }

    public static boolean doSerialize(JInternalFrame frame) throws ProfileException, model.err.LoginException, FileNotFoundException, IOException, NoTargetFoldersException, SQLException, LoginException, SuccessfullTargetFoldersCreation, 

PropertyVetoException {

        String M = (" --> public void doSerialize(" + frame.getTitle() + ") var: (JInternalFrame frame) :<-- \n");
        System.out.println(M);

        GuideSystems.GuideSystemsJDesktopManager.setCurrentFrame(frame);
        String action = "meta";

        bSaved = true;
        String systemDir = LoginInfo.getSystemFolderSystemDir() + File.separator + frame.getTitle() + EXT;

        NotesFrameAttrToXML nfat = new NotesFrameAttrToXML();
        nfat.sysOut(frame, action);

        FileOutputStream fo = new FileOutputStream(systemDir);
        ObjectOutputStream oo = new ObjectOutputStream(fo);

        oo.writeObject(frame);
        oo.flush();
        oo.close();

        //bSaved = discoverSystemFolderSourceDir();
        return bSaved;
    }
public static final String RESOURCES = ModelUtils.class.getPackage().getName()
            + ".resources.ModelResources";public static final String USERDIRDIR = System.getProperty("user.dir", ".");

and the XML.xml file is in the userdir at:

public static final String XMLRESOURCES = "xml/ModelResourcesXML.xml";

package model.err;

import java.io.FileNotFoundException;
import java.io.IOException;

public class LoginException extends ModelException {
    public LoginException() throws FileNotFoundException, IOException {
        super("LoginException");
        System.out.println("JOptionPane delivered error message \n " +
                "Login failed Please contact the Webmaster." );
    }
}

import model.ModelUtils;

public class ModelException extends Exception {
    public ModelException(String messageKey) throws FileNotFoundException, IOException {
        super(ModelUtils.getXMLResource(messageKey));
    }
}package model.err;

import java.io.FileNotFoundException;
import java.io.IOException;

public class LoginException extends ModelException {
    public LoginException() throws FileNotFoundException, IOException {
        super("LoginException");
        System.out.println("JOptionPane delivered error message \n " +
                "Login failed Please contact the Webmaster." );
    }
}

ModelResourcesXML.xml

<entry key="LoginException"> Login failed.
    Please contact the Webmaster.
    </entry>
    <entry key="UserNameException"> Please enter a user name. </entry>
    <entry key="PasswordMismatchException"> Retype passwords to match! </entry>
    <entry key="PasswordMismatchInstructorException"> Retype Instructor passwords to match! </entry>
    <entry key="PasswordMismatchStudentException"> Retype Student passwords to match! </entry>
 <entry key="UserAssetsNoDeleteException"> Some user assets could not be deleted </entry>package model.err;

 import java.io.FileNotFoundException;
    import java.io.IOException;
    import model.ModelUtils;

    public class ModelException extends Exception {
        public ModelException(String messageKey) throws FileNotFoundException, IOException {
            super(ModelUtils.getXMLResource(messageKey));
        }
    }package model.err;

    import java.io.FileNotFoundException;
    import java.io.IOException;

    public class LoginException extends ModelException {
        public LoginException() throws FileNotFoundException, IOException {
            super("LoginException");
            System.out.println("JOptionPane delivered error message \n " +
                    "Login failed Please contact the Webmaster." );
        }
    }

public static synchronized ResourceBundle getResources() throws FileNotFoundException, IOException {

        if (resources == null) {
            try {
                resources = ResourceBundle.getBundle(RESOURCES);
            } catch (MissingResourceException x) {
                log(x);
                throw new InternalError(x.getMessage());
            }
        }

        return resources;
    }

    public static String getResource(String key) throws FileNotFoundException, IOException {
        System.out.println("useing getResource for instance: " + key);
        return getResources().getString(key);
    }

    public static synchronized Properties loadXMLResources() throws IOException {
        FileInputStream fis = new FileInputStream(XMLRESOURCES);
        xmlResource = new Properties();
        xmlResource.loadFromXML(fis);

        /*
        Enumeration enuKeys = xmlResource.keys();
        while (enuKeys.hasMoreElements()) {
        String key = (String) enuKeys.nextElement();
        String value = xmlResource.getProperty(key);
        System.out.println(key + ": " + value);
        }
         */

        fis.close();
        return xmlResource;
    }

    public static synchronized String getXMLResource(String key) throws FileNotFoundException, IOException {
        return loadXMLResources().getProperty(key);
    }

Recommended Answers

All 5 Replies

ehm ... maybe the exceptions don't occur?

Are you running the jar with javaw.exe? That doesn't have anywhere to display exceptions. If so, try java.exe which will display any uncaught exceptions or sysout/syserr messages in the window where you started it.

I am sure that the app is supposed to throw the bad login exception and several others. I guess my problem may be that I have Netbeans create the *.jar. I then double click and I will check to see if java.exe or javaw.exe is used. I will have to try to use the command line to run
The app with javaw.exe. Thanks for the insight into this Exception anomalies. I will try to figure out the problem.

I am trying to improve command line and ant etc skills. I can not run my guide.jar when I use the command
line. Also I can not navigate to my thumb drives so I can use the path to my guide.jar that is on the thumb drive.
When I double click the guide.jar and choose to open it with javaw it runs with the save error.
I have to "ctrl_alt_delete" to the task manager and end the process javaw.exe to stop the guide.jar
from running when I double click the jar.

any feed back would be a great help

C:\Program Files\Java\jdk1.7.0_15\bin>echo %GUIDE%
C:\Users\Steves\Documents\ceyesumma\java_cache\my_projects\netbeans\guide\t
arget_guide\guide\store

C:\Program Files\Java\jdk1.7.0_15\bin>

C:\Program Files\Java\jdk1.7.0_15\bin>JAVA %GUIDE%\guide.jar
Error: Could not find or load main class C:\Users\Steves\Documents\ceyesumm
a\java_cache\my_projects\netbeans\guide\target_guide\guide\store\guide.jar

C:\Program Files\Java\jdk1.7.0_15\bin>

Hello again.

I have another app that I am having the same problem with. This one has the apache dery imbedded database. Along with no exceptions the app creates my db folder but it does not know how to put the necessary db in the created dir. It to is loading xml to use properties. Netbeans has the derby.jar
file added in the library

C:\Users\Steves\Documents\ceyesumma\java_cache\my_projects\netbeans\schoolofdb\target_musicSystemsdb\misc\db-derby-10.6.2.1-bin\db-derby-10.6.2.1-bin\lib\derby.jar<linkPath>
K:\\.targetGuide\admin_\admin\Note Folder\CREATED ON THUMB\index
</linkPath>





<comment>DTD FOR Schoolofdb project</comment>
  <!--
  Derby Config
  ******************************************************************************************************** config-->
    <entry key="derbyDriver">org.apache.derby.jdbc.EmbeddedDriver</entry>
    <entry key="derbyURL">jdbc:derby:</entry>
  <!--C:\Users\Steves\Documents\ceyesumma\java_cache\my_projects\netbeans\schoolofdb\target_musicSystemsdb\misc\db-derby-10.6.2.1-bin\db-derby-10.6.2.1-bin\lib\derby.jar<linkPath>
K:\\.targetGuide\admin_\admin\Note Folder\CREATED ON THUMB\index
</linkPath>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.