Login  Register

user.home Error in Prefs

Posted by Grant Harris on Feb 28, 2013; 9:06pm
URL: http://imagej.273.s1.nabble.com/user-home-Error-in-Prefs-tp5001923.html

I've run into this problem a couple of times on Windows 7;  
I get an error finding and saving IJPrefs...
Because IJPrefs is now put in the user's directory (rather than ImageJ's dir)
is seems that we've run into a "long outstanding bug in Java": http://bugs.sun.com/view_bug.do?bug_id=4787931
There are situations where System.getProperty("user.home") gives the wrong directory, so I guess that Prefs#load() fails.  It looks as though getting the user.home directory can reliably be gotten this way:
                       
javax.swing.filechooser.FileSystemView.getFileSystemView().getDefaultDirectory();

-- Grant

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html