Self deletable jar

Hi,
When I build my project and double click my .jar file in the dist folder, I would like it to delete itself. How can I do this ?
Basically what my jar file does is it contains a shortcut "TrayIcon.jar.lnk" that copies to the users startup folder, and then the TrayIcon.jar copies itself to the root of the C: drive (C:\TrayIcon.jar), so the next time the user loads windows, my shortcut file TrayIcon.jar.lnk (that is already pointing to C:\TrayIcon.jar) loads my application (Its a tray Icon that when you double click it goes to the url of my web app). Instead of the user having to go the traditional way of creating a firefox bookmark on his desktop and having to open that each time, I thought it would be neat to have a tray icon that kind of "installs itself" to the C: drive and would always be there when you open windows.
I already tried to use the delete method (duuuhhh) and also tried to execute it command line using Process process = Runtime.getRuntime().exec(cmd); and oddly enough it would work about 1/10 of the time.
I read the topic "Java Programming [Archive] - Classloader won't let me delete jar file!" but that dates from 2003 and seems a bit too complicated for what I need to do.
Can anyone help me figure out how to get my TrayIcon.jar file to delete itself after its done doing its work ?
thanks, kev

The jar file cannot execute any functionality, regardless of what it is, which would delete the jar before the VM exits.
A script file that waits for the vm to exit and then deletes the jar would seem an obious solution to me.
The user runs the script file not the jar.

Similar Messages

  • Is there a way to create a user account that "expires", or self deletes itself after a set amount of time?

    I am hoping to find a way to create an Admin account for our parent body that can be used for items at home, "adding printers, software, wireless settings, etc...), but have that account either "expire" or self delete itself after say 72 hours?
    Thoughts?
    Jesse

    Will they be needing to keep files saved for a while?  I'm guessing no, since you're ok with it auto-deleting after a short while.
    You could just use the guest user:  http://support.apple.com/kb/PH11321
    But I'm not aware of any way that you could setup an account to expire.

  • JRockIt Deleting JAR files - Error loading class

    Hi there,
    Customer is facing a very weird issue. Their application has an application that contains some EJBs and Web applications that, apparently for no reason, it starts to unload classes and delete JAR files and WAR files from the Weblogic's "extract" directory. If I bounce the application, everything starts working fine until a moment where the issues starts again.
    I thought this was any kind of memory issue that was not allowing the JVM to free enough resource for loading the classes again after unloading it. But we gave enough memory for the JVM and it stills happening.
    Thoughts? Any idea that might help us on troubleshooting is very welcome at this time.
    Thanks in advance,
    Davi

    e-blade wrote:
    Manifest-Version: 1.0
    Class-Path: lib/tools.jar
    Created-By: 1.6.0_18 (Sun Microsystems Inc.)
    Main-Class: MainThe line in bold means: when app.jar will be run, it will look for additional classes in <same OS directory as itself>/lib/tools.jar.
    It does not mean that it will look inside itself in the JAR directory /lib/tools.jar.

  • Manual backup of bookmark json file is empty, export of bookmark html file "self-deletes"

    I'm now using Firefox 17.0.11esr in Win 7 at work and 26.0 in Win XP at home. I tried 24.2.0esr at work, but had to return to the earlier version, because of this problem below, which also happens with my home machine:
    I cannot save, manually or automatically, a usable bookmarks json file for use as a backup. The files are always empty.
    When I try to export a bookmarks html file, it begins to create and save it, but then "self-deletes" it before it's done.
    Why is this a problem with 24.2.0esr and 26.0, but not 17.0.11esr? What can I do about it?
    Thanks

    You can try to create a new profile and keep both profiles open at the same time.<br />
    You can do that by starting the second instance with the -no-remote command line switch (see further down).
    Then you can do a copy and paste of the bookmarks in the Bookmarks Manager (Library) from the current profile to the Library of the new profile to create a new places.sqlite database file.<br />
    If that works then you can copy this places.sqlite file to your current profile folder.<br />
    You will lose the history, but it is possible to copy history items to a bookmarks folder in the new profile.
    See "Creating a profile":
    *https://support.mozilla.org/kb/profile-manager-create-and-remove-firefox-profiles
    *http://kb.mozillazine.org/Standard_diagnostic_-_Firefox#Profile_issues
    You can also opt to keep using the new profile and transfer some files from the old profile to the new profile, but be cautious not to copy corrupted files to avoid carrying over the problem.
    *http://kb.mozillazine.org/Transferring_data_to_a_new_profile_-_Firefox
    See:
    *http://kb.mozillazine.org/Creating_a_new_Firefox_profile_on_Windows
    Use the -no-remote command line switch to open another Firefox instance with its own profile and run multiple Firefox instances simultaneously.
    *http://kb.mozillazine.org/Opening_a_new_instance_of_Firefox_with_another_profile
    *https://developer.mozilla.org/Mozilla/Multiple_Firefox_Profiles

  • Cant Delete Jar in Apache Jserv? Why???

    Hi all
    Can any one tell me why i cant delete my jar file in Apache Jserv, servlets folder. It says access denied. I stopped apache server and then tried to delete it. But no use. Help me in this matter.
    One more problem i am getting is my jar file is not able to access the dependent class files like oreilly's Multipart request class. In wrapper classpath i had given oreilly's package path, and my jar is also included in wrapper class path.
    The above jar file i was talking is created by me.
    Expecting your help soon.....
    Thanks and Regards
    Ramesh.

    Hi Ramesh,
    If you're unable to move or delete .jar, .log, .conf, or any other files after stopping Apache, the JVM has not been properly stopped. When you start Apache with Apache JServ configured, a separate JVM (java.exe) process is started. Many Win32 users use Ctrl-C to stop Apache, and this does not stop the JVM. Also, occassionally with buggy code or buggy VMs, the Java process will not respond to Apache's requests to shutdown.
    The preferred way of stopping the JVM properly is to use the command line options to shutdown Apache. In NT, you can type "net stop apache", and on all Win32, you can type "apache -k shutdown", from a command prompt. This should properly shutdown the JVM.
    If the JVM does not die, you will have to manually kill the process. In 95/98, Ctrl-Alt-Del will list the processes; select the process and click "End Process". In NT, start the task manager, select the process, right click, and select end process. If that doesn't stop your JVM, reboot.
    Hope this will help you.
    Regards,
    Anil.
    Technical Support Engineer.

  • Self-Duplicating and Self-deleting tracks.

    So, I checked around, but I can't find my issue anywhere.  The topics must either be in plain sight or not around...
    Anyway, what my issue with iTunes is that the songs in my library are making copies of themselves and after a while the originals stop working and can't be found on my computer.  Then the copies do the same.  Sometimes the songs just skip straight to deleting themselves.  I have no idea how to fix this issue and it is really bothing me as some of the songs I have purchased online and I don't think there should be a need for me to hunt the songs down again just because iTunes felt the need to get rid of them in the first place...  
    iTunes used to work just fine up until a few updates ago.  Now I have this problem.  Additionally, iTunes starts to open automatically on start-up.  I just removed it from the start-up list (again). So, here's hoping that works.
    Does anyone know how to fix this issue?
    Edit: Well, now that I posted this, I am seeing topics about the self-deletion, but not the self-duplicating.....
    Message was edited by: Crisanta

    we could not complete your itune request An unknown error occurred (12002) pls solve my problam??

  • My iPhone4 self deletes music files. Any thoughts of what I need to do?

    My iPhone4 is self deleting my music files. Any thoughts of how to correct this issue?

    Try a reset: Simultaneously hold down the Home and On buttons until the device shuts down. Ignore the off slider if it appears. Once shut down is complete, if it doesn't restart on it own, turn the device back on using the On button. In some cases it also helps to double click the Home button and close all apps from the tray before doing the reset.

  • Flash installer self deletes?

    I installed Adobe products today (Photoshop, Lightroom), and Adobe Media Player was included.  I don't know that it was cause / effect, but I was on YouTube shortly thereafter and got only black screens.  (Firefox5 and Opera12, 100% non-functional.  Very buggy in IE9.)
    Research indicated that this condition happens to a lot of people, but for many reasons, and I was unable to narrow done causes or solutions.  I downloaded and overinstalled the latest version of Flash (though my version should have been fully current).  That fixed the problem and YouTube videos played fine afterward.
    However, I noticed that the installer was missing.?  I download all installers to a specific directory so it was easily noticed.
    Is the Flash installer supposed to self delete?  If so, why?  If so, it would be nice to be advised.
    (Didn't care for the default selected McAfee garbageware on the dowload page.  Would have been very easy to miss.  The 'download' button is designed to bring the eye right past the garbageware.)

    Yes, several times, Tom. You don't copy the entire installer application. You clone the InstallESD.dmg from inside the application package: Contents/SharedSupport/. CTRL- or RIGHT-click on the Install Mac OS X Lion application download and navigate to the indicated folder.
    Open Disk Utility. Select the flash drive and click on the Restore tab in the main window. Drag the flash drive to the Destination field. Drag the InstallESD.dmg file into the Source field. Click on the Restore button.

  • HT201320 After e mails have been delivered, wench another comes in, the existing E mails self delete, any ideas please?

    Sorry, title should read " After e mails arrive, when subsequent e mails arrive, the existing e mails self delete, any ideas please".

    It could be a server setting for mailbox handling. Have you checked what options you have set for for synched mail to another machine.  Log into your email from say your PC and check the settings from there.
    Regards, Ct

  • Rented movie will not self delete

    i rented two movies the last week. both were moved to ipod, both were viewed on ipod, both have expired (24hr view window) while on ipod.
    the first one self deleted, the other remains on my ipod. this expired movie is not listed under the rented movies portion when at the itunes level (and device is selected). however, when i click on the ipod under "devices" in itunes, then select the "rented movies" under the list of directories, i see the rented movie, just ghosted.
    i cant select or delete it.
    i have re-synced several times but i cannot get rid of the movie.
    suggestions?

    figured out how to delete movie. but what i havent figured out is why i had to. my only guess is i didnt completely watch the movie in 24 hrs (i quit while credits were rolling). this is the only difference from the first movie that auto-deleted.
    the fix/work around:
    set your ipod to "manually manage music and video" I also had "enable disk use" although i dont think it matters. once you've done this you can select movie on ipod while docked and delete.
    good luck

  • Self-Deleting Flashplayer12 Installation Package

    Flashplayer 12's installation package, when downloaded and executed from a user's computer, deletes itself on completion of the installation ... why would an installation package do this (consider that such a download could serve as a marker of date/time of the package installation and/or content from which a PC configuration could be restored, or duplicated)?  Is it possible that the Flashplayer 12 installation package assumes that it is being web installed as opposed to downloaded and installed from the local machine, and that this is, in fact, a bug in the install package?

    It's a "Stub" installer, and ALL stub installers self-delete. VLC, Firefox, both use stub installers now, which delete upon initialization of the download. Flash Player stub installers have done this since 2005 that I know of. And if you use the stub installer, it IS a web install. Thewre si no other way. you CAN'T install Flash Playe as a 1mb file. It's eighteen times that big as a FULL download and 54 times as big fully installed.
    Windows System Restore keeps track of what was installed and when, right down to the second it was installed.
    Additionally Windows "datestamps" the installed files.
    You can see this in your Control Panel:
    as well as "timestamping" the files in the folders where they're installed:
    If you MUST HAVE a 17mb file to keep on hand in case of emergency (here's a hint: if you do a System Restore to a time BEFORE you downloaded it, WIndows will likely erase it), the  FULL installers are here:
    Flash Player for ActiveX (Internet Explorer)
    Flash Player Plug-in (All other browsers)

  • Mail is self deleting

    i move emails to the folder i made for them and shortly after they self delete. why? how do i stop this? i am losing lots of receipts, recors, and pics. i am sure it is a setting somewhere, i just do not know where or what to change.

    Dear Allan,
    I'm sorry I didn't reply to your reply which was written some time ago now. I thought the problem had gone but it seems to be happening again. Now I see this reply of yours from a while back and I suspect that I may have my desktop G5 setup for POP mail and my laptop set up for IMAP. I think IMAP is what I need (it's a dotmac account and email I use). How do I alter the settings on my desktop? Do I have to delete mailboxes on my desktop and start all over again with an IMAP setup or is it just a matter of checking a box somewhere within Mail?
    Thanks and sorry I didn't check back. Is there a way of signing up for alerts when replies to questions are posted?
    Stephen Lewis

  • Classloader won't let me delete jar file!

    Hi-
    I am writing a classloader that runs main from a class called MyMain. MyMain loads classes from a jar file called MattTable.jar. I need to be able to delete the jar file once the classes are loaded from it, or even just delete it at the end of the program. Either way, the classloader will not release it so I cannot delete the jar file until after my program finishes. I want to be able to delete it from with in my code after the method is invoked.
    URL urls[] = new URL[] { new File(".").toURL() };
    URLClassLoader loader = new URLClassLoader( urls );
    Class c = loader.loadClass(mainClass);
    Method m1 = c.getMethod("main", new Class[] { args.getClass() });
    //main loads classes from an outside jar file
    m1.invoke( null, new Object[] {args} );
    //Here is where I want to delete the jar file
    //I would even accept file.deleteOnExit() but this won't work either
    If anyone can help me figure out how to delete this file, it would be a great help!
    Thanks,
    Matt

    Hi,
    I've created a small classloader for jar files which releases the handle every time a class is loaded. It might still need some optimization, but at least it works:import java.util.zip.*;
    import java.util.*;
    import java.io.*;
    public class ZipClassLoader extends ClassLoader {
         private Hashtable classes = new Hashtable();
         private File f;
         public ZipClassLoader(String zipFileName) {
              this (new File(zipFileName));
         public ZipClassLoader(File zipFile) {
              f = zipFile;
         public Class loadClass(String className) throws ClassNotFoundException {
              return (loadClass(className, true));
         public synchronized Class loadClass(String className, boolean resolve) throws ClassNotFoundException {
              if (classes.containsKey(className)) return (Class)classes.get(className);
              ZipFile zipFile = null;
              BufferedInputStream bis = null;
              byte[] res = null;
              try {
                   zipFile = new ZipFile(f);
                   ZipEntry zipEntry = zipFile.getEntry(className.replace('.', '/')+".class");
                   res = new byte[(int)zipEntry.getSize()];
                   bis = new BufferedInputStream(zipFile.getInputStream(zipEntry));
                   bis.read(res, 0, res.length);
              } catch (Exception ex) {
              } finally {
                   if (bis!=null) {
                        try {
                             bis.close();
                        } catch (IOException ioex) {}
                   if (zipFile!=null) {
                        try {
                             zipFile.close();
                        } catch (IOException ioex) {}
              if (res == null) return super.findSystemClass(className);
              Class clazz = defineClass(className, res, 0, res.length);
              if (clazz == null) throw new ClassFormatError();
              if (resolve) resolveClass(clazz);
              classes.put(className, clazz);
              return(clazz);
    }This is the test program I've created. It loads a class from the Apache log4j jar file, and deletes the file when the class is loaded:import java.io.File;
    public class Test {
         public static void main(String[] args) throws Exception {
              File f = new File("C:\\jartest\\log4j-1.2.6.jar");
              ZipClassLoader zl = new ZipClassLoader (f);
              Class c = zl.loadClass ("org.apache.log4j.ConsoleAppender", true);
              Object o = c.newInstance();
              System.out.println (o.getClass().getName());
              f.delete();
    }

  • Cannot delete jar file, in us by another person

    I cannot delete a .jar file from my hard drive called C:\javaarchive.jar . I have restarted my computer so no programs running, and tried again to remove it. Always says 'it is being used by another person or program', stop other programs and try again.

    Please take your windows support question to a windows support forum.
    These forums are for help for Java programmers needing help with their Java code.
    We cannot help you solve whatever problems you are having with whatever random program or service. That's not what this forum is about.

  • Address book self-deletes contacts

    Big problem: Lion´s Addressbook deletes my newly added contacts within minutes. This happened to my three or four times now. Newly added or modified contacts dissapear. They are not even in my Time-Machine-Backup though I´ve forced that app to write a backup immediatly after editing the contacts.
    Yesterday I´ve switched to iOS5 and iCloud. Same here: Contacts vanish in every place (Mac, iPhone, iCloud) only minutes later. Have found 2 of them in Time-Machine but can´t bring them back (nothing happens when I hit restore). My fault was to believe that an exported Addressbook-archive would contain the data – but after moving all contacts to iCloud, that archive is completely empty!
    Any suggestions? Have tried Onyx to maintain different operations, but no luck.
    Thanks, Speedy

    It's Apple's viral marketing at work, and you're the (un)lucky one chosen to spread the word!
    Have you tried disabling the sync in Entourage for a while, and deleting the extraneous entries in its address book? If while the sync is disabled you're not getting replicating entries in Entourage but still doing so in Address Book, you've at least knocked out one half of the equation.
    I'm afraid I don't know enough about the inner workings of the Address Book database and sync services to offer much assistance if self-replicating entries still persist. Short of exporting your Address Book a file and erasing all entries and/or reinstalling Address Book, I don't have any other ideas.
    Any one else have any ideas?

Maybe you are looking for

  • Convert applet to swing

    Hi; Could anyone help me to convert my example code from applet to swing,please, thank import java.awt.*; import java.applet.*; import java.lang.Math; import java.awt.Font; import java.lang.Integer; /*** Main class == Applet  ***/ public class Suffix

  • Default settings for sending smart forms via mail saving it in pdf

    do we have to do any default settings in any trasaction code like scot for solving the above problem

  • Pointer to Hand

    How do I get the pointer to change to a hand when the user rolls over a button, like normal web page viewing.  In my project the point just stays the same....a pointer.  Thanks

  • Make Movies Show up in Itunes

    I'm streaming a folder on my computer to my ATV. In Itunes i have the folder listed as my music location under preferences (ie. C:\Shared) Can anyone tell me why when i copy a movie into the folder Itunes will not see the new movie i copied in unless

  • Context Help in diferents Columns in a JTable

    I want to put Context Help in the diferents columns in a JTable (in columns, in headers or cells); but I don't know how I can do it. Please, if somebody can help me, or simply say me that this is not possible (if is really impossible).