Results 1 to 3 of 3
  1. #1
    popey is offline Member
    Join Date
    Oct 2009
    Posts
    1
    Rep Power
    0

    Default execute java program within java program

    hello,

    i want to execute a java program inside a java program ie i have a program entered by a user in textfield , now i want to display the result of javac and java on that program in my applet . please guide me on how to do this.i searched forum and find exec method but it was used to run system commands.can i use it to run another java program.please reply soon

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    Yes you can. It's not used to run System commands only.
    As of I.6 you can also use the compiler API.

  3. #3
    CodesAway's Avatar
    CodesAway is offline Senior Member
    Join Date
    Sep 2009
    Location
    Texas
    Posts
    238
    Rep Power
    6

    Default

    Have you checked out the ProcessBuilder class (Java 5). You can use it to run programs. You can specify arguments, the working directory, environment variables, etc.
    CodesAway - codesaway.info
    writing tools that make writing code a little easier

Similar Threads

  1. Execute external program from java
    By ankitmcgill in forum New To Java
    Replies: 1
    Last Post: 06-01-2009, 03:58 AM
  2. 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
  3. Replies: 0
    Last Post: 04-04-2008, 02:40 PM
  4. Replies: 0
    Last Post: 10-04-2007, 09:33 PM
  5. Execute a new program in java
    By mathias in forum Advanced Java
    Replies: 1
    Last Post: 07-31-2007, 05:42 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
  •