Results 1 to 3 of 3

Thread: Linux Shell

  1. #1
    rp181 is offline Member
    Join Date
    Mar 2009
    Posts
    70
    Rep Power
    0

    Default Linux Shell

    I don't really know where this fits, so posting here. :)

    How do i execute a command one would normally execute from the terminal? I did some googling, but i can't get it to work (nothing happens).

    What i want execute:

    Java Code:
    "streamer -t 01:00:00 -j 100 -o pic.jpeg"
    which you can execute directly from the terminal.

    On a seperate note, how do you find out the host operating system?

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default

    ProcessBuilder. What have you tried and what happened when you tried that?

    OS name, architecture and version can be obtained with System.getProperties().

  3. #3
    rp181 is offline Member
    Join Date
    Mar 2009
    Posts
    70
    Rep Power
    0

    Default

    Thanks,

    I've made some progress, and have gotten a command to execute. The line is:

    Java Code:
    p = Runtime.getRuntime().exec(new String[]{"/bin/sh", "-c","streamer -r 30 -j 100 -t 01:00:00 -o "+workDir+"000000.jpeg"});
    Now, my problem is this:

    When the user exits the program, i must be able to stop the streamer process. p.destroy() simple quits the interpreter, sh. However, streamer continues to run. How do i end that process?

Similar Threads

  1. How to create my own linux shell in java?
    By wahib.tech in forum Advanced Java
    Replies: 1
    Last Post: 10-16-2009, 08:44 AM
  2. Replies: 6
    Last Post: 04-08-2009, 04:05 AM
  3. Bean Shell
    By Bisweswar in forum Advanced Java
    Replies: 2
    Last Post: 08-16-2008, 12:36 AM
  4. Shell Sort in Java
    By Java Tip in forum Algorithms
    Replies: 0
    Last Post: 04-15-2008, 07:44 PM

Posting Permissions

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