Click to See Complete Forum and Search --> : How I can mange one path for linux and windows


rajiv.birari
10-15-2008, 03:04 AM
Hello Friends

I write one jsp for some executions(upload files)
writenow I writing for windows

File file=new File(path+"\\WEB-INF");

String exec1[]={"cmd","/c","\""+path+"\\work\\work.bat\""};

try
{


List<String> command = new ArrayList<String>();
command.add("cmd");
command.add("/C");
command.add("\""+path+"\\work\\work.bat\"");

ProcessBuilder builder = new ProcessBuilder(command);
Map<String, String> environ = builder.environment();
builder.directory(file);

/////////
same code I want write for Linux OS in same file
but How I now which OS I will interact
I write comman code for both

Kindly reply

Regards
RKB

chazzy
10-15-2008, 06:39 AM
you need to just make your code configurable - whether this means you put some settings in a configuration file (maybe Properties?) or in a db, either to be read at runtime, in order to control how your app runs.