I have a big problem..doing a project f file tracker in linux...so, i have to use exec command in linux..as for windows, we have rundll32 url, file protocol handler..what is der here??

10-06-2008, 10:18 PM

fishtoprecords

Quote:

Originally Posted by nlgopi

what is der here??

Can you ask in English?

Look at the Javadocs for System.exec()

10-06-2008, 10:46 PM

nlgopi

hi senior member

just that i couldnt get that else where..i wanna implement a platform independent file tracker,so i gotta get the exec version for linux where i could run files in their own available default application. Can you help me???

Because if you mean PC and Linux, and not OS-X, you will get different answers than if you mean PC, Linux, OS-X, *BSD, AIX, HP-UX and others.

Once you have answered that, how about iPhone and other smart phones?

10-06-2008, 11:21 PM

serjant

Additionally to words of fishtoprecords,if you want to use built-in commands from the OSes like DOS,Shell etc and to run them from Java,so you can do a platform independent if you check on which OS the program is running,so for checking create class constants:

Code:

/**
* some handy constants that can be used throughout the program
*/
public class Constants {
/**
* the name of the OS as given by the Java system property "os.name"
*/
public final static String osname = System.getProperty("os.name");
/**
* true if the program is running on OS X
*/
public final static boolean isOSX = osname.equalsIgnoreCase("Mac OS X");
/**
* true if the program is running on Linux
*/
public final static boolean isLinux = osname.equalsIgnoreCase("Linux");
/**
* true if the program is running on Solaris
*/
public final static boolean isSolaris = osname.equalsIgnoreCase("SunOS");
/**
* true if the program is running on Windows Vista
*/
public final static boolean isVista = osname.equalsIgnoreCase("Windows Vista");
/**
* true if the program is running on Windows
*/
public final static boolean isWindows = !(isOSX || isLinux || isSolaris);
}

And then you can in another class to execute command line commands checking which os is that and then to put the proper command of course in order not to be given different answers from the system