Results 1 to 2 of 2
  1. #1
    itaipee is offline Member
    Join Date
    Dec 2008
    Posts
    99
    Rep Power
    0

    Default get the source code path

    Hi

    I have problem :
    In the program I need to read some text file that is in the same dir as the source ( both java and class files) .
    I using
    Java Code:
    new File(".").getAbsolutePath()
    to extact the path.
    The problem :
    when ever I run my program from differnet directories , the currect directory is change.

    So unless I'm running from the java files dir - the program dont work - what to do ?

  2. #2
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    8

    Default

    You want a text file from the .class file folder, not the source.

    Look at ClassLoader.getResource(). Look out for the funny use of "/" to define the package name.

Similar Threads

  1. Edit Source Lookup Path
    By Taxi in forum Eclipse
    Replies: 1
    Last Post: 02-09-2009, 07:01 AM
  2. help with loops with source code
    By bmxriderss in forum New To Java
    Replies: 2
    Last Post: 01-12-2009, 10:56 AM
  3. Replies: 1
    Last Post: 11-28-2008, 07:27 PM
  4. how to convert source code to xml
    By valery in forum XML
    Replies: 2
    Last Post: 08-06-2007, 09:29 PM
  5. Need a source code
    By vissu007 in forum New To Java
    Replies: 1
    Last Post: 07-05-2007, 08:08 PM

Posting Permissions

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