Results 1 to 6 of 6
  1. #1
    nlgopi is offline Member
    Join Date
    Oct 2008
    Posts
    5
    Rep Power
    0

    Default linux generic Exec command...???

    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??

  2. #2
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    Quote Originally Posted by nlgopi View Post
    what is der here??
    Can you ask in English?

    Look at the Javadocs for System.exec()

  3. #3
    nlgopi is offline Member
    Join Date
    Oct 2008
    Posts
    5
    Rep Power
    0

    Default 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???

  4. #4
    fishtoprecords's Avatar
    fishtoprecords is offline Senior Member
    Join Date
    Jun 2008
    Posts
    571
    Rep Power
    7

    Default

    Writing platform independent Java is easy. Writing platform independent software that uses platform specific tricks is nearly impossible.

    And you have to ask hard questions such as:

    What platforms to you care about?

    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?

  5. #5
    serjant's Avatar
    serjant is offline Senior Member
    Join Date
    Jun 2008
    Location
    Ukraine,Zaporozhye
    Posts
    487
    Rep Power
    7

    Default

    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:

    Java 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

  6. #6
    nlgopi is offline Member
    Join Date
    Oct 2008
    Posts
    5
    Rep Power
    0

    Default Hi senior member...

    Quote Originally Posted by fishtoprecords View Post
    Writing platform independent Java is easy. Writing platform independent software that uses platform specific tricks is nearly impossible.

    And you have to ask hard questions such as:

    What platforms to you care about?

    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?
    Thank you,senior ...ll try out something which doesnt need any specific tricks..

Similar Threads

  1. Replies: 6
    Last Post: 04-08-2009, 05:05 AM
  2. Runtime.exec()
    By hknyo in forum Advanced Java
    Replies: 2
    Last Post: 08-16-2008, 01:40 AM
  3. linux command to start a java web server
    By lazarus in forum JavaServer Faces (JSF)
    Replies: 0
    Last Post: 06-24-2008, 04:30 PM
  4. calling linux command line in java
    By fangzhong in forum New To Java
    Replies: 0
    Last Post: 02-03-2008, 05:24 PM
  5. Unable to execute command line command in java
    By LordSM in forum New To Java
    Replies: 1
    Last Post: 08-08-2007, 01:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •