S
Stefan Ram
I would like to collect some opinions and information about
the association between meanings of directory paths (i.e.,
what are the directories intended to be used for?) and Java SE
expressions for directory paths.
This is intended to answer questions like: Which directory
might be suggested to the user as a default for certain
operations, like storing a document file that was just created
and edited by the user?
The answer to such a question should be a Java SE expression
that gives an appropriate path under all possible environments
(like, for example, Windows or Linux).
So far, I have collected some Java expressions that can be
printed with the program below.
I would appreciate any comments about what others think that
each of those paths could or should be used for by a Java
application, even if someone only comments one or two paths,
but not all of them.
I also would like to know what this program prints on other
systems (especially on a Linux System, but also different
variants of Windows), but feel free to remove parts of the
output to protect privacy or security.
Of course, I also like to learn about other expressions that
might evaluate to other directory paths with a certain meaning.
A possible output of the program might look like:
os.name =
Windows 2000
os.version =
5.0
java.home =
C:\Program Files\JAVA\JRE1.7.0
user.home =
C:\WINDOWS
user.dir =
C:\dvl
java.io.tmpdir =
C:\WINDOWS\TEMP\
fileSystemView.getDefaultDirectory() =
C:\data
C:\data
fileSystemView.getHomeDirectory() =
C:\WINDOWS\Desktop
C:\WINDOWS\Desktop
getCodeSource().getLocation() =
C:\dvl
C:\dvl
class Main
{
public static void print( final java.lang.String string )
{ java.lang.System.out.println( string + " =" );
java.lang.System.out.println( System.getProperty( string ));
java.lang.System.out.println(); }
public static void print( final java.io.File file )
throws java.io.IOException
{ java.lang.System.out.println( file.getAbsolutePath() );
java.lang.System.out.println( file.getCanonicalPath() );
java.lang.System.out.println(); }
public static void main( final java.lang.String[] args )
throws java.lang.Exception
{
print( "os.name" );
print( "os.version" );
print( "java.home" );
print( "user.home" );
print( "user.dir" );
print( "java.io.tmpdir" );
final javax.swing.filechooser.FileSystemView fileSystemView =
javax.swing.filechooser.FileSystemView.getFileSystemView();
java.lang.System.out.println( "fileSystemView.getDefaultDirectory() =" );
print( fileSystemView.getDefaultDirectory() );
java.lang.System.out.println( "fileSystemView.getHomeDirectory() =" );
print( fileSystemView.getHomeDirectory() );
java.lang.System.out.println( "getCodeSource().getLocation() =" );
print( new java.io.File( Main.class.getProtectionDomain().getCodeSource().
getLocation().toURI() )); }}
the association between meanings of directory paths (i.e.,
what are the directories intended to be used for?) and Java SE
expressions for directory paths.
This is intended to answer questions like: Which directory
might be suggested to the user as a default for certain
operations, like storing a document file that was just created
and edited by the user?
The answer to such a question should be a Java SE expression
that gives an appropriate path under all possible environments
(like, for example, Windows or Linux).
So far, I have collected some Java expressions that can be
printed with the program below.
I would appreciate any comments about what others think that
each of those paths could or should be used for by a Java
application, even if someone only comments one or two paths,
but not all of them.
I also would like to know what this program prints on other
systems (especially on a Linux System, but also different
variants of Windows), but feel free to remove parts of the
output to protect privacy or security.
Of course, I also like to learn about other expressions that
might evaluate to other directory paths with a certain meaning.
A possible output of the program might look like:
os.name =
Windows 2000
os.version =
5.0
java.home =
C:\Program Files\JAVA\JRE1.7.0
user.home =
C:\WINDOWS
user.dir =
C:\dvl
java.io.tmpdir =
C:\WINDOWS\TEMP\
fileSystemView.getDefaultDirectory() =
C:\data
C:\data
fileSystemView.getHomeDirectory() =
C:\WINDOWS\Desktop
C:\WINDOWS\Desktop
getCodeSource().getLocation() =
C:\dvl
C:\dvl
class Main
{
public static void print( final java.lang.String string )
{ java.lang.System.out.println( string + " =" );
java.lang.System.out.println( System.getProperty( string ));
java.lang.System.out.println(); }
public static void print( final java.io.File file )
throws java.io.IOException
{ java.lang.System.out.println( file.getAbsolutePath() );
java.lang.System.out.println( file.getCanonicalPath() );
java.lang.System.out.println(); }
public static void main( final java.lang.String[] args )
throws java.lang.Exception
{
print( "os.name" );
print( "os.version" );
print( "java.home" );
print( "user.home" );
print( "user.dir" );
print( "java.io.tmpdir" );
final javax.swing.filechooser.FileSystemView fileSystemView =
javax.swing.filechooser.FileSystemView.getFileSystemView();
java.lang.System.out.println( "fileSystemView.getDefaultDirectory() =" );
print( fileSystemView.getDefaultDirectory() );
java.lang.System.out.println( "fileSystemView.getHomeDirectory() =" );
print( fileSystemView.getHomeDirectory() );
java.lang.System.out.println( "getCodeSource().getLocation() =" );
print( new java.io.File( Main.class.getProtectionDomain().getCodeSource().
getLocation().toURI() )); }}