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);
}