Results 1 to 3 of 3
  1. #1
    yoodidoo is offline Member
    Join Date
    Jul 2009
    Rep Power

    Default "First Launch" Event?

    I was currently working on an application of mine, and I'd like for it to
    execute some code the first time it's launched only, and would not execute
    that code any other time it's opened afterwards.

    Could someone tell me how I could achieve this? Thanks.

  2. #2
    dlorde is offline Senior Member
    Join Date
    Jun 2008
    Rep Power


    You could do your one-time actions, then create a file in the application directory. Before your one-time actions, just check if the file exists. Something like this:
    Java Code:
    String userDir = System.getProperty("user.dir");
    String fileName = "one-time.tst";
    File testFile = new File(userDir + File.separator + fileName);
    if (!testFile.exists()) {
    ... // continue
    I left out the exception handling.

  3. #3
    yoodidoo is offline Member
    Join Date
    Jul 2009
    Rep Power


    Thanks for your reply, I was thinking of something along those lines, but the
    method you gave seems better.

Similar Threads

  1. Java, Military Format using "/" and "%" Operator!!
    By sk8rsam77 in forum New To Java
    Replies: 11
    Last Post: 02-26-2010, 04:03 AM
  2. getDisplayLanguage returns "en" not "English"
    By DD70 in forum New To Java
    Replies: 6
    Last Post: 08-12-2009, 11:22 PM
  3. Replies: 2
    Last Post: 01-24-2009, 07:56 PM
  4. Eclispe: "Launch failed. Binary not found"
    By qwertyuiop23 in forum Eclipse
    Replies: 1
    Last Post: 11-16-2008, 07:06 AM
  5. Replies: 1
    Last Post: 10-20-2008, 07:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts