Results 1 to 10 of 10
  1. #1
    chyrl is offline Senior Member
    Join Date
    Mar 2010
    Location
    Manila, Philippines
    Posts
    257
    Rep Power
    5

    Exclamation displaying javac on GUI

    I am developing a system the a .java file will run under javac.
    But instead of running it on command prompt. I wanted the javac to return the display into a GUI.

    Is this possible?
    What classes or methods I am suppose to use?

    Thanks.
    Every project, package, class, method, variable, syntax, algorithm, etc.
    are registered in my memory bank. Thanks to this thread.

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,457
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by chyrl View Post
    I am developing a system the a .java file will run under javac.
    But instead of running it on command prompt. I wanted the javac to return the display into a GUI.

    Is this possible?
    What classes or methods I am suppose to use?

    Thanks.
    When you go to the index.html page of the API documentation you'll see a big block with all the frameworks and technologies; the second block from the left in the top row reads 'javac'; it describes the API for the javac compiler, and javac's output can be captured in any stream you want.

    kind regards,

    Jos

  3. #3
    chyrl is offline Senior Member
    Join Date
    Mar 2010
    Location
    Manila, Philippines
    Posts
    257
    Rep Power
    5

    Exclamation

    Quote Originally Posted by JosAH View Post
    When you go to the index.html page of the API documentation you'll see a big block with all the frameworks and technologies; the second block from the left in the top row reads 'javac'; it describes the API for the javac compiler, and javac's output can be captured in any stream you want.

    kind regards,

    Jos
    Can you elaborate further? What streaming logic I am going to use?
    Every project, package, class, method, variable, syntax, algorithm, etc.
    are registered in my memory bank. Thanks to this thread.

  4. #4
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,457
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by chyrl View Post
    Can you elaborate further? What streaming logic I am going to use?
    It's all in the API documentation; I am not going to do this for you; you have to do your own work; start by reading the API docs.

    kind regards,

    Jos

  5. #5
    chyrl is offline Senior Member
    Join Date
    Mar 2010
    Location
    Manila, Philippines
    Posts
    257
    Rep Power
    5

    Default

    Is it the JavaCompiler class?
    Every project, package, class, method, variable, syntax, algorithm, etc.
    are registered in my memory bank. Thanks to this thread.

  6. #6
    JvlShz is offline Member
    Join Date
    Jun 2010
    Posts
    26
    Rep Power
    0

    Default

    Java Code:
    ProcessBuilder builder = new ProcessBuilder();
    builder.command("javac.exe", [other options]);
    Process p = builder.start();
    p.redirectErrorStream(true);
    BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
    String line;
    while ((line = reader.readLine()) != null) {
     yourGUI.appendLine(line);
    }

  7. #7
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,457
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by JvlShz View Post
    Java Code:
    ProcessBuilder builder = new ProcessBuilder();
    builder.command("javac.exe", [other options]);
    Process p = builder.start();
    p.redirectErrorStream(true);
    BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
    String line;
    while ((line = reader.readLine()) != null) {
     yourGUI.appendLine(line);
    }
    We don't spoonfeed code here (without any comments or explanation). Above all the javac compiler has its own API, there is no need to start another procecess for it, it is old fashioned and considered clumsy.

    kind regards,

    Jos

  8. #8
    JvlShz is offline Member
    Join Date
    Jun 2010
    Posts
    26
    Rep Power
    0

    Default

    I believe its self explanatory

  9. #9
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,457
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by JvlShz View Post
    I believe its self explanatory
    Maybe to you and a few other readers it is but still, it is not done to dump and spoonfeed code.

    kind regards,

    Jos

  10. #10
    chyrl is offline Senior Member
    Join Date
    Mar 2010
    Location
    Manila, Philippines
    Posts
    257
    Rep Power
    5

    Default

    Thanks.
    I will solve this thread later after I have done it.
    Every project, package, class, method, variable, syntax, algorithm, etc.
    are registered in my memory bank. Thanks to this thread.

Similar Threads

  1. javac
    By PhilArmstrong in forum New To Java
    Replies: 31
    Last Post: 11-21-2009, 03:46 PM
  2. Javac is not recognized?
    By Java idiot in forum New To Java
    Replies: 4
    Last Post: 08-03-2009, 06:54 PM
  3. javac?
    By sardare in forum Eclipse
    Replies: 1
    Last Post: 06-14-2008, 02:06 AM
  4. javac DOS
    By rdunne in forum New To Java
    Replies: 3
    Last Post: 01-01-2008, 11:49 AM
  5. Help with javaC
    By Daniel in forum New To Java
    Replies: 2
    Last Post: 07-04-2007, 02: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
  •