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 7 of 7

Thread: API to Invoke the TERMINAL in UBUNTU

  1. #1
    Junior Member amitection's Avatar
    Join Date
    May 2014
    Location
    India
    Posts
    24
    My Mood
    Busy
    Thanks
    6
    Thanked 2 Times in 2 Posts

    Lightbulb API to Invoke the TERMINAL in UBUNTU

    I know i am posting it in the wrong forum. I was totally confused to post this question in which forum.

    I am trying to build and IDE for NASM in Java for Ubuntu.
    There are other IDE's for NASM but they are in C or C++. So i thought i should try making one in Java.
    Well i am done with the GUI part.

    Could anyone tell me how should i link the NASM compiler to the IDE.
    OR
    There is another way like "DEV C++ IDE" does in Windows is that it invokes the CMD and runs it in that so i could try doing something like that by invoking the TERMINAL in Ubuntu and running it in that.

    Does anyone have any idea how any one of my ideas can be realised. Does java have an API for this purpose.

    Thankyou!
    ăϻі


  2. #2
    Member
    Join Date
    Jul 2013
    Location
    Europe
    Posts
    394
    Thanks
    0
    Thanked 65 Times in 55 Posts

    Default Re: API to Invoke the TERMINAL in UBUNTU

    Try googling the "exec" method of Runtime or the process builder. Both allow you to call other programs.

  3. The Following User Says Thank You to Cornix For This Useful Post:

    amitection (June 5th, 2014)

  4. #3
    Junior Member amitection's Avatar
    Join Date
    May 2014
    Location
    India
    Posts
    24
    My Mood
    Busy
    Thanks
    6
    Thanked 2 Times in 2 Posts

    Default Re: API to Invoke the TERMINAL in UBUNTU

    Quote Originally Posted by Cornix View Post
    Try googling the "exec" method of Runtime or the process builder. Both allow you to call other programs.
    Well i tried using the API you suggested. It works well.

    But now there is a new problem!!!!
    In windows all annotation for command prompt is cmd. So the word 'cmd' can be passed as a parameter.
    But what should be passed as parameter to invoke the TERMINAL??
    if i tried just passing 'terminal' but it didnt seem to work.

    In short
    command prompt -> cmd
    terminal -> ???
    ăϻі

  5. #4
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    4,453
    My Mood
    Mellow
    Thanks
    146
    Thanked 607 Times in 594 Posts

    Default Re: API to Invoke the TERMINAL in UBUNTU

    Depending on the desktop your Ubuntu installation is using, the terminal or command window can be one of several possible terminal programs. Find out which terminal programs your desktop is using and call one of those.

  6. #5
    Junior Member amitection's Avatar
    Join Date
    May 2014
    Location
    India
    Posts
    24
    My Mood
    Busy
    Thanks
    6
    Thanked 2 Times in 2 Posts

    Default Re: API to Invoke the TERMINAL in UBUNTU

    Quote Originally Posted by GregBrannon View Post
    Depending on the desktop your Ubuntu installation is using, the terminal or command window can be one of several possible terminal programs. Find out which terminal programs your desktop is using and call one of those.
    Sorry for the dumb question but m new to Ubuntu...
    How should i find out which terminal program i am using?
    ăϻі

  7. #6
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    4,453
    My Mood
    Mellow
    Thanks
    146
    Thanked 607 Times in 594 Posts

    Default Re: API to Invoke the TERMINAL in UBUNTU

    When I searched "ubuntu terminal," this is the first result. That page should help you identify and find the terminal program based on your chosen desktop environment. If not, there were several other search results that should help.

  8. The Following User Says Thank You to GregBrannon For This Useful Post:

    amitection (June 7th, 2014)

  9. #7
    Junior Member amitection's Avatar
    Join Date
    May 2014
    Location
    India
    Posts
    24
    My Mood
    Busy
    Thanks
    6
    Thanked 2 Times in 2 Posts

    Default Re: API to Invoke the TERMINAL in UBUNTU

    Quote Originally Posted by GregBrannon View Post
    When I searched "ubuntu terminal," this is the first result. That page should help you identify and find the terminal program based on your chosen desktop environment. If not, there were several other search results that should help.
    Thanks for the link.
    But my friend figured out the solution.
    To invoke the terminal in Ubuntu you needn't pass any special command 'cmd' in the getRuntime().exec() API like you have to do it in Windows.
    You simply pass the executable file or anything you need to run in an array in the Runtime API.
    ăϻі

Similar Threads

  1. Is this code an API? Beginner learning to write an API and decoupling.
    By Learning2Java in forum Java Theory & Questions
    Replies: 3
    Last Post: April 22nd, 2014, 12:59 PM
  2. how to run a command in ubuntu terminal
    By bean in forum What's Wrong With My Code?
    Replies: 1
    Last Post: January 6th, 2014, 08:19 AM
  3. Invoke methods
    By wdh in forum What's Wrong With My Code?
    Replies: 3
    Last Post: April 18th, 2012, 08:17 AM
  4. Timer expires invoke method
    By jack_nutt in forum What's Wrong With My Code?
    Replies: 7
    Last Post: July 11th, 2011, 05:52 PM
  5. how to invoke a method?????
    By amr in forum Java Theory & Questions
    Replies: 2
    Last Post: December 2nd, 2010, 10:48 PM

Tags for this Thread