Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9204621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:45:13+00:00 2026-06-17T23:45:13+00:00

I am using a Mac and I am new to it. Here is my

  • 0

I am using a Mac and I am new to it. Here is my question:

There is a folder that I require to include as a File object in Java. When I try this:

File firefoxProfileFolder = new File("/Users/prime/work/dmall/selenium/src/test/resources/firefoxprofile");

It works fine. This code is located in file: /Users/prime/work/dmall/selenium/src/test/java/com/dmall/utils/WebUtil.java

But when I try this:

File firefoxProfileFolder = new File("../../../../resources/firefoxprofile");

I can not load the folder. So the relative path from this file to that folder seems not to work. So what should I do? What is it I am doing wrong?

I require to use the relative path because this code will be run from the server, on which I have no idea what the absoulte path will be.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T23:45:14+00:00Added an answer on June 17, 2026 at 11:45 pm

    You can obtain the directory at runtime:

    URL url = ClassLoader.getSystemResource("relative to/classpath/resources/firefoxprofile");
    File file = new File(url.getFile()); // the directory
    ....    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using SWT on Mac. I create a Unified ToolBar. On this toolbar there is
I am new here. I recently installed plotutils-dev on my mac using fink, but
I've started using Coda because I just got a new Mac, and I want
file.txt contains: ##w## ##wew## using mac 10.6, bash shell, the command: cat file.txt |
This question is exactly like this question: How to get MAC address of your
Look at the following line of java: Mac.getInstance(HmacSHA1); If I put this in a
I am new to programming for Mac, so forgive me if my question is
modules exists inside new processes before import, using python-multiprocessing on osx. Here's an example:
This is my first question after leeching over here for some time.. So spare
Using Mac OS X 10.6.2, Eclipse SDK 3.5.2. I installed the Android plugin, following

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.