Java Relative Paths: Complete Guide

  1. Relative path to the current working directory: such as “file.txt”
  2. Relative path to the current package: for example “com/example/file.txt”
  3. Relative path to parent directory: for example, “../file.txt”
  4. Relative path to a subdirectory of the current working directory: for example “folder/file.txt”
  5. Relative path to the classpath: for example “resources/file.txt”
bannerAds