Skip to main content
added 25 characters in body
Source Link
SatyaTNV
  • 4.1k
  • 3
  • 17
  • 32

Trying to use System.getProperty("user.home/myfile.txt")

System.getProperty("user.home/myfile.txt") 

getting NullPointerExceptionNullPointerException

Using String path String("/Users/user/myfile.txt")

 String("/Users/user/myfile.txt") 

everything works well.

Need universal way of files location. Not everyone have the same path :)

I'm on MacOSX 10.11. java 8

Thanks

Trying to use System.getProperty("user.home/myfile.txt") getting NullPointerException

Using String path String("/Users/user/myfile.txt") everything works well.

Need universal way of files location. Not everyone have the same path :)

I'm on MacOSX 10.11. java 8

Thanks

Trying to use

System.getProperty("user.home/myfile.txt") 

getting NullPointerException

Using String path

 String("/Users/user/myfile.txt") 

everything works well.

Need universal way of files location. Not everyone have the same path :)

I'm on MacOSX 10.11. java 8

Thanks

Post Migrated Here from programmers.stackexchange.com (revisions)
Source Link

How to determine String file location path in Java

Trying to use System.getProperty("user.home/myfile.txt") getting NullPointerException

Using String path String("/Users/user/myfile.txt") everything works well.

Need universal way of files location. Not everyone have the same path :)

I'm on MacOSX 10.11. java 8

Thanks