Results 1 to 3 of 3
  1. #1
    sgthale is offline Member
    Join Date
    Apr 2011
    Posts
    48
    Rep Power
    0

    Default Getting location of the java application

    How do you get the location of the application that you are running? Id like to get the path location it is in the form of a string so I can load all of the other images and what not. e.g. "C://My Documents//Application" blah

  2. #2
    Tolls is online now Moderator
    Join Date
    Apr 2009
    Posts
    12,015
    Rep Power
    20

    Default Re: Getting location of the java application

    Jar up your application, including all the images, and use getResource, or getResourceAsStream to load the images. It's a lot easier than trying to figure out where you are.

    If you need to write to files, use the System property "user.home" and create a directory under there somewhere for your application files, which is what most apps do.

  3. #3
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,453
    Rep Power
    25

    Default Re: Getting location of the java application

    get the location of the application
    Do you mean where the class file is loaded from or where the current directory is when the program is executing?
    The class files would be in a folder on the classpath. I think getResource could tell you.

Similar Threads

  1. java applet location
    By waqar100 in forum New To Java
    Replies: 0
    Last Post: 06-10-2010, 07:47 PM
  2. need to copy file from one location to another location
    By naveen.dpt2007 in forum New To Java
    Replies: 4
    Last Post: 02-28-2010, 03:53 PM
  3. location provider returns no location
    By sandeeprao.techno in forum CLDC and MIDP
    Replies: 0
    Last Post: 09-24-2009, 09:54 AM
  4. (Location based Service) application for Pocket PC
    By talk_to_vivekmishra in forum CLDC and MIDP
    Replies: 0
    Last Post: 08-14-2007, 08:23 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
  •