Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2013
    Rep Power

    Default Get Folder access inside Jar File

    Hello Everyone,

    I am trying to open firefox Browser using selenium webdriver.
    Selenium driver required File object with that profile folder location(It is folder containing Profile files)

    Java Code:
    File profDir = new File(getClass().getResource("/resources/kpdb7u9a").getPath());
    FirefoxProfile ffProfile = new FirefoxProfile(profDir);
    Here I am trying to refer "kpdb7u9a" folder and passing it to FirefoxProfile construtor as FileObject.
    When I run code from Jar file : location of kpdb7u9a shows like : file:/C:/Users/t7744d0/Documents/NetBeansProjects/JARTest/dist/JARTest.jar!/resources/kpdb7u9a

    Now When I tried to check if I got a proper Folder reference or not, I use these codes to check :

    All returns false.

    File Object "profDir" is actually Empty.

    Can anyone help me to resolve this issue. FirefoxProfile is not able to get this folder from inside Jar file
    I ahve kept this folder inside Jarfile.

    Thank you in advance

    Dharmesh Patel

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Washington, DC
    Rep Power

    Default Re: Get Folder access inside Jar File

    Files inside jars are not handled by the File class. They are resources.
    How to Ask Questions the Smart Way
    Static Void Games - GameDev tutorials, free Java and JavaScript hosting!
    Static Void Games forum - Come say hello!

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Eastern Florida
    Rep Power

    Default Re: Get Folder access inside Jar File

    You can't use the File class to access "files" that are in a jarfile.
    If the program requires a disk file vs a stream, you will need to copy the file out of the jarfile to a disk file.
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. [ask] listfiles from folders inside a folder
    By goklien in forum New To Java
    Replies: 3
    Last Post: 05-12-2011, 04:29 PM
  2. how to access a file in the present folder.
    By AnanthNag.Kundanala in forum New To Java
    Replies: 2
    Last Post: 01-11-2011, 03:40 PM
  3. Replies: 0
    Last Post: 10-28-2010, 12:46 PM
  4. Access to resources inside jar file
    By aleks.farrier in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 04-15-2009, 01:29 PM
  5. how to access shared file/folder in LAN
    By ksheetiz in forum Networking
    Replies: 1
    Last Post: 05-24-2008, 04:54 AM

Tags for this Thread

Posting Permissions

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