Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Terminal within Java GUI

  1. #1
    Junior Member
    Join Date
    Sep 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Terminal within Java GUI

    Hi guys,
    I have developed a Java GUI by using Netbean. The user interface will get the user parameters that are needed by a c++ program (which I also developed). Upon clicking the run button java will execute the c++ program with the inserted parameters by launching and X-term session (using Runtime.getRuntime().exec(command) ) . Everything works fine in this way. However I do not find very elegant to launch an external terminal to run the C++ code. Is it possibile to have a terminal that is integrated within the java GUI? And run the C++ code within it?
    Moreover, since the C++ code may take several hours to finish the job is there a way to read its output and use it in order to make, for example, proceed a progress bar?
    Thank you so much for the help!


  2. #2
    Senior Member
    Join Date
    Jul 2013
    Location
    Europe
    Posts
    666
    Thanks
    0
    Thanked 121 Times in 105 Posts

    Default Re: Terminal within Java GUI

    Maybe you should read up on the java native interface (JNI). It allows you to call native code (compiled C, C++, etc). This might be more like what you want.

  3. #3
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Terminal within Java GUI

    Welcome to the Forum! Please read this topic to learn how to post code correctly and other useful tips for newcomers.

  4. #4
    Member
    Join Date
    Dec 2013
    Location
    Honolulu
    Posts
    83
    Thanks
    1
    Thanked 4 Times in 2 Posts

    Default Re: Terminal within Java GUI

    Terminal with Java Gui; this is an interesting topic. For example if you use a passcode to enter into your computer, you would see a secure password entry. The method used is System.console(); This invokes the console object and provides input and output streams through the reader and writer methods. This uses a readPassword( ) method. This is a good example of what you are trying to get at in your example.

  5. #5
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,140
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Terminal within Java GUI

    Please leave old threads alone.

    Thread closed
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. how to test arrays in a terminal in java?
    By hemla in forum Java Theory & Questions
    Replies: 5
    Last Post: April 11th, 2013, 06:55 AM
  2. Integrated Java With Terminal
    By MFD-Stark in forum Java Theory & Questions
    Replies: 2
    Last Post: January 2nd, 2013, 12:23 PM
  3. [SOLVED] GUI: Moving away from the terminal
    By hippoCase in forum Java Theory & Questions
    Replies: 3
    Last Post: June 11th, 2012, 02:17 PM
  4. [SOLVED] Stopping java in terminal
    By Scotty in forum Java Theory & Questions
    Replies: 1
    Last Post: May 7th, 2011, 06:53 PM
  5. Need some help with OSX Java (Terminal)
    By mkoop in forum What's Wrong With My Code?
    Replies: 5
    Last Post: January 14th, 2011, 12:23 PM