Search:

Type: Posts; User: javapenguin

Search: Search took 0.11 seconds.

  1. Re: locating the path to a jar file within a program

    String exampleClassDirectory = Example.class.getResource("Example.class").getPath();

    Also, it appears you're using a static variable called class to call getResource()
  2. Re: locating the path to a jar file within a program

    That's the problem. How will it know where the directory is if the jar is installed or put anywhere on other computers?

    Also, why are you returning the path of the parent file? Why not the jar...
  3. Re: locating the path to a jar file within a program

    Hmmmm...well,

    File aFile = new File();

    String absolutePathName = aFile.getAbsolutePath();

    String pathName = aFile.getPath();

    Also, maybe I'm wrong, but don't you need the full path...
  4. Re: locating the path to a jar file within a program

    Wait, is the code supposed to make it a jar file for you? If not, just go to export and Runnable Jar File. If that won't work, try export and Jar File.
  5. Re: locating the path to a jar file within a program

    Put the Jar file in the same area as your code



    You can find it under "Properties" if you're using Eclipse:


    Path: /wenguin/src/McWoo/Testing.java
    Type: File (Java Source File)...
Results 1 to 5 of 5