Displacement of the executable jar breaks the function of the app economy

Since last week, I tried to deploy my application of office as an executable jar file, but I am facing the following problem: when I move the jar from its original location of construction, my application become impossible to write in external files. I first thought that the problem was the dependent path; However, when installs the app can still load the data in these files.

The solution is probably simple, but for some reason, I still find .

The application consists of a jar file and a folder named "files" containing text files (for example, library.data) to which the serialized objects are written.

I wouldn't be surprised if the problem has to do with the file xml, but any change, I've tried so far have failed. If it is likely that this is the problem, I'll be happy to post a copy of it on demand.

public static void saveLibraryToFile() {
    File file = new File(System.getProperty("user.dir")+"\\files\\library.data");
    if (file != null && file.exists()) {
        library = new Library(sortedAccounts, accountCategoriesMap, accountCategoriesList);
        try {
            FileOutputStream fos = new FileOutputStream(file);
            BufferedOutputStream bos = new BufferedOutputStream(fos);
            ObjectOutputStream oos = new ObjectOutputStream(bos);
            oos.writeObject(library);
            oos.close();
        } catch (Exception e) { // catches ANY exception
            System.out.println(e);
        }
    } else {
        System.out.println("this is not supposed to happen!");
    }
}

Any help would be greatly appreciated.

(PS: A complete set for most of the relevant codes that I use, including the complete xml file Ant, located at:)

( http://stackoverflow.com/questions/22732274/java-save-method-stops-working-when-jar-is-moved)

I partially solved my problem after reviewing the error from the console. Thank you baftos for me having to look it up.

Apparently, all this time, my problem was caused by trying to launch the application after move on the desktop. If I move the application to another directory, such as C:\randomFolder, the app works very well.

Being resolved, out of curiosity, is their anyway completely deny this problem and allow to run the application from anywhere? Or is it simply impossible because of the various security risks?

---EDIT-----------------------------------

So the problem was more to do with the files/folders to access authorization and privileges.

(check the rp0428 response below for more information)

Tags: Java

Similar Questions

  • Memory used by the Windows executable jar file

    I wrote a java program that locates my position of mouse pointer, and then it moves on the screen using the Robot class. I created a file executable (executable) jar of this java single file and executed. Then I went to Task Manager processes list and saw that the exe is 11MB, which seems pretty huge for me. Anyone know why its occupying 11 MB of memory? And is it normal to occupy this physical memory much?

    Only 11MB? What is your problem? In order to execute a jar file, the JAVA virtual machine must be loaded into memory, so this 11 is actually JVM + your jar file, as well as all resources used.

  • Why - jar option used to install software that is located in the executable jar file?

    Hi all
    I have a question, I have a generic installer that is used to install oracle weblogic 10.3 in unix (i.e., who is in the .jar extension) platform which is the executable jar file.

    To install this software that do use - jar installation option
    java-jar net_server < version > _generic.jar

    My question why we use - jar option of install or extract the software

    can any one clarify my doubts...

    Thanks in advance
    Aerts

    Published by: sumanth_abhi on January 27, 2009 23:50
  • My Apple music does not work it takes me to the application once I click on a song it will break the app

    My Apple music does not work it takes me to the application once I click on a song it will break the app

    I had to factory reset my phone twice. So once when I graded down to beta 10 to 9.3.2. One then once more and then my music application has started working again. I hope this helps.

  • Why the App Store search function does not work?

    Since the iOS most recent update (9.3.2), the app from the App Store does not work on my iPhone-iTunes app works perfectly, the App Store - space wasted on the screen and memory right now. I tried to disconnect, close the software, restart hard to my phone, but all I get when I try to search is a white screen. I can't even comment to apple in the app because it does not work. It was a time where this kind of thing never happened but the versions of software with major bugs is becoming more of a recurring theme lately. I'm really starting to wonder if Apple jumps right away even the most basic of pre-tests prior to publication just to get out a release. Frustrating to say the least.

    The search function on the App store on my phone work if something is wrong with your system. Try to reset the App Store in the following order:

    Close the App Store completely from the window of the selector app by double clicking the Home button and slide up the App Store preview pane until it disappears from the display. Then sign out of the iTunes Store (in the settings).

    Then perform a forced reboot. Hold down the Home and Sleep/Wake buttons simultaneously for about 15-20 seconds, until the Apple logo appears.

    Then reconnect to the iTunes Store.

  • When I am inside an application and press on through one of the functions it opens app Sporting Goods of Dick. How do I unpair them?

    When I am inside an application and press on through one of the functions it opens app Sporting Goods of Dick. How do I unpair them?

    What app are you? Offer app purchases?

    Otherwise, you can remove the application

    Restart the phone

    Re install the software?

  • I can't copy pictures or videos of my Photos updated app. If I try to export the app freezes. When I try a copy/paste or do drag function only a miniature photo is placed in the destination. Is there a solution?

    Photos app freezes when I try to export photos or videos.   When I try a copy/paste or do drag function only a photo thumbnail is generated on the destination.  Is there a solution?

    Welcome to the Apple community.

    Try to repair the library holding down ⌥ ⌘ at the launch of the app.

  • Calling a function when you open an application via the App Overview

    Hello! I was wondering if there is a signal that is sent when opening an application through the overview of the App:

    What I mean is: I develop an application, where you can insert data through the invocation. These data are not displayed, when im back to my application with the preview of the App. Is there a way I could load a function "reload" (that I create myself of course) when the user opens my app with this overview of the app?

    each type of help is very appreciated!

    Thanks in advance

    Welcome to the forums.

    Did you mean a minimized ranging signal in full or are you really taking on a signal when the user opens your app?

    Current signals when your application is running are detailed here...

    http://developer.BlackBerry.com/native/reference/Cascades/bb__application.html#signal-index

  • Recently I connect to the net via hspa(3g) on windows 8 and try to download the apps store but stuck at 0% and if stucks to waiting for a break.

    I installed the Windows 8 32-bit operating system on my laptop.

    Recently I connect to the net via hspa(3g) on windows 8 and try to download the apps store but stuck at 0% and if stucks to waiting for a break.
    updates are available, when I install the updates, repeatedly paused at any time.
    I left it for download for hours, to no avail.
    I would like to say that my windows is activated and my laptop have win8 and double windows win7.
    I found the result in microsoft technical support by restarting the update through cmd, but in its service also not worked.
    Please help me in this topic, there are lots of apps in the store that I want to download but can not download.
    Please help................................................................
    Thanks in advance
    Original title: Apps are not download

    Hi imran,.

    I solve my problem of the post of the same problem. There is the correct method, i.e.
    By pressing win + w, then typing troubleshooting and choosing the troubleshooting in the windows updates.
    Then he fix something and fix my problem.
    Thnak you for taking interest in my problem.
  • How am I able to set the keyboard shortcut for the displacement of the layers vertically ctrl + [and ctrl +]? (CS6)

    How am I able to set the keyboard shortcut for the displacement of the layers vertically ctrl + [and ctrl +]?

    You shouldn't have to they are the default ones. You can change these keyboard shortcuts Application Menus layers organize section. Down is backwards and upwards towards the front

  • I have a problem of my catalogs of PES 10 displacement and the photos attached from my old computer with Windows XP on my new computer with Windows 10.  The problem is that I can't remember the arrangement of the original tree of my photo folders when I r

    I have a problem of my catalogs of PES 10 displacement and the photos attached from my old computer with Windows XP on my new computer with Windows 10.  How can I keep my original photo folders tree arrangement when I restore backups of catalog on the new machine?

    The problem arises because Windows 10 is equipped with a new tree structure with new names for many of its branches.  Tree of Windows XP starts to Local Disk (C), and then does the following: Documents and settings, Susan [it's me the user], My Documents, SusanPhotos (the folder that I created that contains my photos) and then several subfolders and subfolders with my photos grouped by theme, for example the Puglia Italy and Italy-Roma.  My new computer Windows 10 has a different tree and different names for a large number of branches from early on: OS (C) [instead of Local Disk (C)], users, Susan, Documents [instead of the old My Documents], SusanPhotos [what I created] and then the subfolders and so on.

    Because of the new tree and the new names of the branch, I can't find a way to restore my PES 10 catalogues and photos attached to them to where I want to that they.  What I want to do is put the files from SusanPhotos to the Windows 10 Documents folder so that I find myself with the following tree, essentially the same as what I had on my old machine: OS (C), users, Documents, Susan, SusanPhotos, then the original subfolders with my photos.  Apparently 10 PSE does not allow me to move folders of photos in the Organizer, so that the pictures stay connected.

    PES 10 offers 3 options for restoration: Original, personalized and customized, keeping the original structure of the file.  Here's what happens to each:

    (1) original creates new folders with the old names and the structure of the tree, parallel to the tree Windows 10 has instead of inside the tree Windows 10.

    (2) custom with the original structure of the file is the restaurant where I want (within the SusanPhotos) but retains all branches superfluous-instant initial tree of Windows XP, production: BONES (C), users, Documents, Susan, SusanPhotos, Documents and settings [carried over from the old computer], Susan, My Documents, SusanPhotos, Roma-Italy and Italy-Puglia and so on.

    (3) custom (without checking the original file structure box) makes every SusanPhotos but without any organization: OS (C),..., SusanPhotos, Italy-Puglia and Italy-Roma and all other folders at the same level instead of in their original nested groups with subfolders.

    The first two methods you end up with a tree that is chaotic with two parallel trunks or a single trunk but with several redundant layers carried over from the old computer.  The third ends with no tree at all.

    One solution would be to make a Custom Restore with the original structure of the file and then use PSE10 to move the folders that I would like.  However, AFAIK, PSE10 I cannot move entire folders of photos, only of individual pictures.  With thousands of photos in hundreds of cases, the time required for the movement of individual pictures is prohibitive.  PSE10 allows me to move the catalog folder, but apparently not the folders containing the photos.

    The result is that at this time I have no solution to my problem.  Can you help me find a way to restore my photos while keeping their original organization?

    One solution would be to make a Custom Restore with the original structure of the file and then use PSE10 to move the folders that I would like.  However, AFAIK, PSE10 I cannot move entire folders of photos, only of individual pictures.

    You simply use the 'Files' Panel on the left. Your folder tree appears. Simply, you drag and drop the folder to move with all its subfolders in the desired master file. That works exactly as in Solution Explorer, so be patient, you receive no message of progress until it is completed.

    You did a good job to understand the situation. I think that might help you is to understand that changes in the way default folders are created in a different version of Windows can be ignored if you do not use these structure 'default', from the shortcuts to your main folder of the user.

    I create a master folder 'My Photos' directly under the C: root.

    When I restore, I use the "custom" choice, as you have discovered, I only specify this folder in the restore process, and I completely ignore the default shortcuts to 'Documents' or 'Image '.

  • Problems of displacement of the layers

    I've been a user of items for 10 years, using ss12 since June. Recently, I had a problem of displacement of the layers inside and between files. When you work on a file, if I try to drag and drop a layer it just snaps back to where it was. I can move the layer with the arrow keys, but it fully takes to long. I do not understand why it started earlier past. I can open my previous version, PE 6 and move layers I have always done, but since I paid for upgrade to ss12 it would be nice to be able to use it. Any input on how to fix this would be greatly appreciated! Thanks in advance, Kirsten

    With Yosemite Mac user? If so, see:

    Photoshop Elements does not respond when you use Mac OS X 10.10 editing tools

  • The App Store search function does not work on iOS 9.3.3

    Search in the App store does not work for me since the upgrade to iOS 9.3.3

    Is that what someone else has this problem or can tell me how to fix it?

    Probably this will seem like a strange solution, but try to press the search key at the bottom of the App Store search 10 times screen. I read that it helped a lot of people.

  • The APP catalog keeps breaking

    I don't know why, but App catalog returns with "unknown error" every time I do a search. I'm running wireless via a captive 3 G connection so maybe it's a question of wait time. But it's annoying.

    Alan

    I'm actually on vodafone 3G card with my Virgin on my home wireless.

    I think you're right - it's a problem of 3G, not the app catalog itself - so apologies to HP for this.

    It was working fine yesterday all about 3G and worked OK last night when I got home too.

    Alan

  • Can FND_USER_PKG be executed or used by the APPS Schema

    Hello

    I have a client who needs to use applications. FND_USER_PKG (to update password etc.) through the APPS Schema.

    Is it supported?

    Kind regards

    Hugues

    Hello Pravin,

    Thanks for the tips.

    It is not supported. It is considered as customization and Oracle will not be supported.

    How to: Run the application as a custom user [1483548.1] Packages

    Kind regards

    Hugues

Maybe you are looking for