• Post Reply Bookmark Topic Watch Topic
  • New Topic

System.getPropertie("user.dir") pointing to eclipse installation directory  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everybody,

In java spec, System.getPropertie("user.dir") should point to the user current working directory

http://docs.oracle.com/javase/tutorial/essential/environment/sysprop.html

In my case, it points to eclipse installation directory. Therefore, when I create a file using relative path, the JVM puts every thing in eclipse installation directory !!

Does anyone have an idea of what causes such behavior and how it is possible to change it.

Regards,
 
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When running code in a container -whether a servlet container, or an IDE, or an OSGi platform- the current directory is unpredictable, and most likely not what you expect. So you can't rely on relative paths.
 
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and Welcome to JavaRanch moaad el amrani
 
moaad el amrani
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

That helped thank you for your answer Ulf Dittmer
@Seetharaman Venkatasamy: Thanks
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If we are using the "user.dir" the system will always point to the "User working directory"
We can give "user.home" for using the home directory "User home directory"
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!