Hello!
Faced a problem: when running code from under Eclipse, the code works fine, but after exporting to jar, File.canRead () and sanWrite () return false, which causes the program to fail, although the file exists (Created in the environment and not deleted anywhere) .
Problem file initialization code:
static File data = new File("data/data.txt"); data.setWritable(true, true); data.setReadable(true, true); if(!data.canRead() || !data.canWrite()){ JOptionPane.showMessageDialog(null, "Error file! Read: " + data.canRead() + " Write: " + data.canWrite() + " Patch: " + data.getAbsolutePath()); return; }
Content Manifest.ML:
Manifest-Version: 1.0 Class-Path: . Main-Class: ua.com.swgroup.homechat.homechat Application-Name: HomeChat Permissions: all-permissions
Export order on 1 screen. Window after launching on 2 screen.
PS: Also, after exporting, a mass of left classes is created, I will be glad if you explain why they are created (In the main method there are enums with ClientID, ImageType, MessagePosition) - made the screen at number 3.
All screenshots: http://imgur.com/a/CfT0I