Personal computing discussed
Moderators: renee, SecretSquirrel, just brew it!
wibeasley wrote:I like your test. What don't you like about it, does it slow performance?
In .net, you have to ability to assert permissions. Does java have something similar? Here's an example that tests if you have permission to do things with File IO in a specific directory at runtime: http://msdn.microsoft.com/en-us/library/91wteedy.aspx
try
{
FileReader fi = new FileReader(Configuration.defaultTestDataPath + "infofile.txt")
}
catch(FileNotFoundException e)
{
//Redirections
System.err.println("Error accessing network data files, redirecting to local copies.");
}
wobbles-grogan wrote:If you can ping it with the .isReachable() function, I think that's preferable than writing you own commands for two reasons. First, the java function is probably just a wrapper around the same system calls, so you save time programming. Second, I imagine the resulting code is more portable when you avoid making calls to the OS.The process class is basically a class that lets you run commands from within your java program.