3

I have a relative file for a file upload

private String myPath= "..server\\app\\src\\test\\resources";

that is checked into source control. Everyone will have the same file structure for their file including and after server. However, since developers might have their repositories n different directories, I can't hard code the entire file path. How can I get the fully qualified file path from the relative path?

1 Answer 1

1

Use

String absolutePath = new File(myPath).getAbsolutePath();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.