Results 1 to 3 of 3
  1. #1
    rahid is offline Member
    Join Date
    May 2010
    Posts
    5
    Rep Power
    0

    Default Error execute command through jsp

    Hello there,
    For a varsity project i need to execute a shell command from jsp. Some of my command works. But not all. My system is Linux (Ubuntu distro), Java 1.6 & Glashfish server.

    When i try this

    Java Code:
    <% Runtime.getRuntime().exec( "gedit" ); %>
    The Text editor automatically open.

    But for this

    Java Code:
    <% Runtime.getRuntime().exec( "g++ code.cpp -o code" ); %>
    Nothing happen. The code.cpp didn't complie.

    Whats wrong. What should i do. Please help.

    :confused:

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,574
    Rep Power
    23

    Default

    If it didn't compile, were there errors?
    IS there an error log where the compiler could write its errors.

  3. #3
    rahid is offline Member
    Join Date
    May 2010
    Posts
    5
    Rep Power
    0

    Default

    No errors it shows.

    I'm using Netbeans. When I try to execute a file with

    Java Code:
    <% Runtime.getRuntime().exec( "./code" ); %>

    The code file I kept in the NetBeansProjects/MY_PROJECT/web directory. But it shows an error.

    Java Code:
    java.io.IOException: Cannot run program "./compile": java.io.IOException: error=2, No such file or directory

    Please help!!

Similar Threads

  1. NetBeans 6.8 Execute through OTA error
    By Chirieac in forum NetBeans
    Replies: 0
    Last Post: 01-04-2010, 02:56 PM
  2. Replies: 1
    Last Post: 10-29-2009, 11:48 AM
  3. Execute a jar command from a java program
    By apremanandh in forum New To Java
    Replies: 3
    Last Post: 05-21-2008, 02:04 PM
  4. Unable to execute command line command in java
    By LordSM in forum New To Java
    Replies: 1
    Last Post: 08-08-2007, 12:23 AM
  5. error stack when I try to execute my code
    By paty in forum New To Java
    Replies: 1
    Last Post: 08-02-2007, 08:32 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
  •