Open a UNIX terminal (with a remote login session) on JButton click

All,
-- The domain of this problem blurs the line which decides if this question has to be posed on a Java swing audience or a UNIX forum. To understand this problem apart from being a Java swing person, you would also need to have a basic understanding of UNIX concepts such as gnome-terminal, xterm and rsh --
I am creating a network monitoring GUI which has a JTable having many entries that pertains to various system information about nodes in a network. I have overridden the default cellEditor in the table with a custom TableCellEditor (camickr's archive) and have a column containing JButtons labelled with hostnames.
Now, when a user clicks on any of these buttons, I would like to open up a terminal (xterm or /usr/bin/gnome-terminal) followed by executing some commands on this NEW terminal shell. In other words, I would like to automate this process as if the user opens a terminal and then keys in commands to rsh into the remote host by specifying the hostname (which is the label on the JButton) and finally provide the user with this state, from where on she takes control on that remote login session.
I tried searching through various previous posts. I did find a related one:
http://forum.java.sun.com/thread.jspa?threadID=5180094&messageID=9699614#9699614
But I still have difficulty in getting my problem solved.
The following statements are executed when one such button (labelled by a hostname) is clicked:
public void actionPerformed(ActionEvent e) {
         String hostname = e.getActionCommand();
            fireEditingStopped();
            System.out.println( "probing:  " + hostname); //This appears correctly on the console
            Process p;
               try {
                    p = Runtime.getRuntime().exec("/usr/bin/gnome-terminal");
                    BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
                    BufferedWriter out = new BufferedWriter(new OutputStreamWriter(p.getOutputStream()));
                                out.write("rsh -l root "+hostname); //attempting to remote login in the NEW shell (terminal)..... I guess :|
               } catch (IOException e1) {
                    // TODO Auto-generated catch block
                    e1.printStackTrace();
.I guess I am not having control on the new terminal. Is there any way I could control the newly spawned shell?
Appreciate,
Rajiv

Alright...
assuming gnome-terminal is in /usr/bin path,
/usr/bin/gnome-terminal -e "<command>"
would solve this problem

Similar Messages

  • Copy Paste doesn't work during and after a remote login session

    Hi 
    I am using a Windows 7 Home Premium Service Pack 1 laptop to login into Linux. I am using Putty and Xming to SSH and view the desktop. Whenever I start a session the copy paste functionality gets disabled in my laptop,i.e., I cannot copy text from one text
    file to another or within the same text file. The copy paste doesn't work even upon closing the connection. 
    From what I have gathered it is not possible to copy from one computer(host) to another(guest) during a remote login session but I am not able to copy within my windows laptop. 
    Is there some setting that I need to change to prevent it from happening? What are the possible solutions?
    Thank You
    Rishabh

    Hi,
    Are you able to copy and paste in the putty session, with mouse or keyboard?
    Using PuTTY
    http://the.earth.li/~sgtatham/putty/0.52/htmldoc/Chapter3.html
    Please restart your PC to check whether you can get back the copy and paste function. It can be caused by some compatibility issue.
    Please also run "sfc /scannow", check if it find and fix any errors.
    NOTE
    This
    response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you.
    Microsoft
    does not control these sites and has not tested any software or information found on these sites.
    Regards
    Yolanda
    TechNet Community Support

  • How open multiple responsibilities in the same user login session in R12 ?

    Dear All,
    Can anyone help me to know how to open multiple responsibility in the same user login session in R12 ?
    Thanks..
    Edited by: G-oracle on Sep 18, 2011 11:22 AM

    Can anyone help me to know how to open multiple responsibility in the same user login session in R12 ?What do you mean by open multiple responsibilities in the same session? You can only see the menu of one responsibility at a time, so how to do you expect the application to let you see multiple responsibilities/menus in one session?
    You could open another session and this way you can access more than one responsibility at the same time.
    Thanks,
    Hussein

  • How to open a new tab with the same current directory in a terminal?

    I use the following script to open a new terminal with the same pwd.
    I'm wondering how to modify it to open a new tab with the same pwd.
    #!/bin/sh
    # Open a new terminal in the cwd
    CWD=`pwd`
    osascript<<END
    set thePath to "$CWD"
    set myPath to (POSIX file thePath as alias)
    try
    tell application "Terminal"
    activate
    do script with command "cd \"" & thePath & "\""
    end tell
    end try
    END

    bit of a hack, but the make command doesn't seem to work for tabs in terminal. replace what's currently in the 'try' block with this code:
    tell application "Terminal" to activate
    tell application "System Events"
    tell process "Terminal"
    keystroke "t" using command down
    end tell
    end tell
    tell application "Terminal"
    do script "cd " & (quoted form of thePath) in last tab of window 1
    end tell

  • Remote login questions

    I have an account on my parent's mac at their place which I log into occasionally via screen sharing/back to my mac. Is it possible, instead of using screen sharing, to log into my account remotely, see and use my desktop, without disrupting their session? I could be at home seeing the screen as it appears in my profile and they can be using the computer at the same time in their profile.
    I vaguely remember this being done in windows (Server 2003) by some HP network engineers I used to work with.
    I played with the remote login feature in the sharing prefpane and using ssh, but that just logged me into my user account via terminal, which I'm completely unfamiliar with.
    Both their Mac and mine are running 10.5. Is it possible?
    Thanks,
    Sean

    Is it possible, instead of using screen sharing, to log into my account remotely, see and use my desktop, without disrupting their session
    No. Mac OS X supports only a single desktop, so all GUI users see the same thing.
    There was some project that aimed to implement this through some X11 hack, but I haven't seen anything about it in a while.

  • Can I open a putty terminal using AIR in windows m/c

    I want to open a putty terminal in same m/c on a button click
    from an AIR application. As far as i came to know AIR doesn't
    support to run external exe . I dont want to use any third party
    softwares.. Is there any other work arround ?? Can I open it using
    Socket? Any kind of pointer will be very helpful.
    Thanks

    "anjiu" <[email protected]> wrote in message
    news:gcvdvq$7uu$[email protected]..
    >I want to open a putty terminal in same m/c on a button
    click from an AIR
    > application. As far as i came to know AIR doesn't
    support to run external
    > exe .
    > I dont want to use any third party softwares.. Is there
    any other work
    > arround
    > ?? Can I open it using Socket? Any kind of help will be
    very helpful.
    http://www.jeffryhouser.com/index.cfm/2008/4/22/Using-AIR-to-launch-other-applications

  • Displaying login sessions on workstations using Command Prompt

    Hi there,
    Anyone know of a command similar to wmic.exe /node:IP-or-HostName ComputerSystem Get UserName in a Command Prompt which displays remote login sessions on a workstation rather than the console login sessions that use local accounts set up
    on workstations.
    Thanks,
    RocknRollTim
    P.S. I was redirected by a couple of forum users off the Microsoft Community Forum.

    Hi Ben Lavender,
    Thank you for responding to my forum thread again and thank you for making the correction on the WMIC command, I tried both sets of commands for WMIC and found that the WMIC command in your previous post was invalid whereas the one you posted last was correct
    and was showing results, however there a few questions I would like to ask with regards to the WMIC command you posted last. How far back does the command go? When there are no dates and times next to account entries, does this mean that users have never logged
    on to that machine or does this mean that the remote system has never retained this information in it's registry? I remember doing an error check on the machine I tested this command on as it was having performance problems and was developing a bad sector
    on the disk at the time, would this cause the information not to display as expected? Also I configure out the date and time entry for each account entry but what does the information after the decimal point mean? Does it represent milliseconds for the time
    element? Lastly I tried running the psloggedon app from the psloggedon suite on my Windows 7 x64 machine and now when I come to run it, it appears for a split second and then disappears, the same also happens for all the other apps from the psloggedon suite
    after agreeing to license agreement for each app. I decided to do some research to confirm what are the system requirements to run the apps from this suite and the website says that it's only compatible with systems that have Windows XP and higher and/or Windows
    Server 2003 and higher which I thought should have worked, I then decided to run the apps as Run As Administrator and they did the same thing as before, I also changed the compatibility settings of each app to run as Windows XP Service Pack 3 but again they
    all did the same thing as before, does this mean that the suite of apps aren't compatible with 64-bit systems and only work with 32-bit systems?
    Your help would be much appreciated.
    Kind regards,
    RocknRollTim       

  • Running a command in a remote Powershell session

    Hi,
    I have used the Enter-PSSession to get a remote session on a domain controller... all is ok with that.
    when i run the following command it fails, however if i run this locally on the domain controller it succeeds. this command is correct, it just fails with the remote powershell session
    dsacls.exe "OU=MYTestOU,OU=Servers,DC=MyDomain,DC=Local" /G "mydomain\MyComputer$":GRGWCC
    I have tried placing c:\windows\system32 before the exe, and i have also tried cmd /c dsacls.exe .........
    i cant figure out why this doesnt work, can anyone help?
    thanks
    Steve

    strange, if i run the command for a user account instead of a computer account and remove the "" around it, it works.
    dsacls.exe "OU=MYTestOU,OU=Servers,DC=MyDomain,DC=Local" /G mydomain\steve:GRGWCC
    it must be that $ sign that is causing the problems....?

  • Regarding Login session doesnt expire

    If i close the browser(presentation services) without logging out, the next time i click the url from history or from my favorites its loggin me into the application without asking my username and password.
    how do i end the session automatically whenever the browser is closed?
    is there any options to be set in the config file??
    Thanks in Advance.

    Yep you are absolutely right. If i keep other browser windows open and close the presentation services, the login session deoesnt expire whereas if i close all the browsers and try opening the presentation services it asks for a username/password.
    But I found the same behaviour in Mozilla too...
    is there a way to avoid this?
    Thanks a Lot.

  • How to properly end a Remote Desktop session?

    I use Remote Desktop to access multiple PCs at work that run scheduled tasks on Task Scheduler.  For these tasks to run correctly I need to be logged into the machine.  We have Group Policy, that I cannot get changed, that limits a disconnected
    remote session to 2 days.  It appears to me, that because of this, my PCs are logging out on Sundays due to the fact that I last remoted into them on Friday.  I am able to remote back into the PCs on Sunday evening and allow my processes to run correctly
    on Monday morning, but I would like to not have to do this every week.  Is there a way to end the remote session, stay logged into the PC, and not be in the disconnected state that is causing the log off with the group policy?  I do not experience
    any problems with PCs that I log into locally and then lock.  Can I put my PCs in this same locked state, as if I were locking and ending a local session, when I end a remote session?

    When you go into a remote desktop session. Simply click the "X" on the upper menu bar and it will keep you logged into the client computer but close it out of your screen. However, if someone logs into the client computer locally it wil disconnect your
    session and there is no way around that.
    Don't forget to mark the post that solved your issue as &quot;Answered.&quot; By marking the Answer you are enabling users with similar issues to find what helped you. Lewis Renwick - IT Professional

  • Can't download files -even the support center's remote login appl won't download;  web sites like USA Today will not open; etc.

    This all started by certain sites not opening, like USA Today; Intellicast.com.  Installed Maverics yesterday successfully and the web sites very briefly worked and then starting failing again.  Called tech support and couldn't download their remote login code.  From Safari's viewpoint thought there might be a problem with Adobe Flash.  So deleted that and then tried to download the installer code from Adobe and that wouldn't download.  Suggestions would be appreciated.

    Firefox can find plugins in several locations, but Firefox 21 changed the location of the "shared" plugin folder so older installers like the Microsoft Windows Media Plugin no longer drop the DLL file in the correct location.
    There apparently are two ways to address this:
    (1) Change a Firefox preference so that Firefox checks the old location. Here's how:
    (i) In a new tab, type or paste '''about:config''' in the address bar and press Enter. Click the button promising to be careful.
    (ii) In the filter box, type or paste '''plugins''' and pause while the list is filtered
    (iii) Double-click '''plugins.load_appdir_plugins''' to switch its value from false to true.
    This will take effect after you restart Firefox.
    (2) Copy the plugins folder to the new location. Here's how on Win 7 64-bit:
    Open a Windows Explorer window to:
    C:\Program Files (x86)\Mozilla Firefox
    Right-click and copy the '''Plugins''' folder
    Double-click the '''browser''' folder to open it
    Right-click and paste
    Right-click the new copy of '''Plugins''' and rename it to '''plugins'''
    After restarting Firefox, the plugins in that folder should now be available.
    ''Edit: I suggest just doing #1.''

  • Can't Set Remote Login OFF via Send Unix Command systemsetup

    Trying to use the System Setup->Remote Login template in ARD to turn off Remote Login (SSH) in Sharing panel of System Preferences on Mac that is administered through Apple Remote Desktop.
    In Apple Remote Desktop (ARD), I select the client machine, then choose "Send Unix Command..." from the "Manage" menu. In resultant window, I pick "System Setup->Remote Login (SSH) from the "Template" drop down box in the upper right. That populates the upper window with Unix commands. I edit/change the "on" to "off" and tell the dialog to Run command as User: root, then click on "Send" button.
    Progress bar goes forever with no change.
    I can turn off Remote Login via ARD by controlling each client machine via an ARD WINDOW, then navigating to the Sharing Preference pane, but that process is tedious when performing for multiple client Macs.
    Strange, but I CAN use the "Send Unix Command..." outlined above to turn ON Remote Login, and get the status of Remote Login ("systemsetup -getremotelogin"). Just can't turn OFF Remote Login (quickly/efficiently).
    man systemsetup suggests I need to write the command as "setremotelogin -f off" but that failed with an improper command syntax error.
    Thoughts?

    It’s waiting for you to type a confirmation. If you run this command on the command line normally, you’ll see the message:
    Do you really want to turn remote login off? If you do, you will lose this connection and can only turn it back on locally at the server (yes/no)?
    Use this command instead:
    systemsetup -f -setremotelogin off

  • Osascript for remote login does not work with Leopard

    We are testing Leopard on one computer in our labs. The only problem so far is that the osascript that we use to remote login to the computers stopped working (although it works fine on the Tiger machines):
    osascript <<EndOfMyScript
    tell application "System Events"
    keystroke "public"
    keystroke tab
    delay 0.5
    keystroke return
    keystroke tab
    delay 0.5
    keystroke return
    keystroke return
    end tell
    EndOfMyScript
    This is a public account with no user password. I've read the discussion below, but have not been able to tweak the command so that it works with Leopard. Any suggestions?
    Thanks.
    http://lists.apple.com/archives/Remote-desktop/2007/Nov/msg00045.html

    I'm having a similar problem - the script below works with my G5 iMacs running 10.4.9 but not the Intel iMacs running 10.4.8. It almost works - the username and password appear in the right boxes, so I run around the room pressing the Return key.
    # This script when used with ASR Send UNIX command will login workstations at the LoginWindow.
    # The script assumes that the cursor is focused in the Name field.
    osascript -e 'tell application "System Events" to keystroke "username"'; \
    osascript -e 'tell application "System Events" to keystroke tab'; \
    osascript -e 'tell application "System Events" to delay 0.5'; \
    osascript -e 'tell application "System Events" to keystroke "password"'; \
    osascript -e 'tell application "System Events" to delay 0.5'; \
    osascript -e 'tell application "System Events" to keystroke return'
    Message was edited by: Catocop

  • The report terminated with error:  REP-110: File test2. cannot be opened. REP-1070: An error occurred while opening or saving a document.

    Hi,
    I'm getting the below error for reports.
    The report terminated with error:
    REP-110: File test2. cannot be opened. REP-1070: An error occurred while opening or saving a document. REP-0110: File test2. cannot be opened. .
    When checked Environment using url 'http://host:port/reports/rwservlet/showenv?server=your_repserver_name"
    found below
    ==================================================
    Reports Servlet Environment Variables 11.1.1.4.0
    Security Mode Non-secure
    HTTP Environment Variables 11.1.1.4.0
    SERVER_NAME   09.14.4.41
    SERVER_PORT   8888
    SCRIPT_NAME   /rwservlet
    SERVER_PROTOCOL   HTTP/1.1
    SERVER_SOFTWARE   undefined
    GATEWAY_INTERFACE   undefined
    SERVER_PORT_SECURE   undefined
    ACCEPT   image/jpeg, application/x-ms-application, image/gif, application/xaml+xml, image/pjpeg, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
    REQUEST_METHOD   GET
    REMOTE_HOST   test-wam-app
    REMOTE_ADDR   09.14.4.41
    REMOTE_USER   undefined
    AUTH_TYPE   undefined
    PATH_INFO   showenv
    QUERY_STRING   server=RptSvr_test-wam-app_wamtest
    PATH_TRANSLATED   undefined
    CONTENT_LENGTH   undefined
    CONTENT_TYPE   undefined
    AUTHORIZATION   undefined
    USER-AGENT   Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.2; Trident/6.0; .NET4.0E; .NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729; InfoPath.3; MS-RTC LM 8)
    REMOTE_IDENT   undefined
    REFERER   undefined
    Oracle Reports Services - Servlet Environment Variables  Select to jump to the top of the page  Return to Top
    KeyMapFile   /u03/apptest/FMW_11.1.1/user_projects/domains/WamTest/config/fmwconfig/servers/WLS_REPORTS/applications/reports_11.1.1.2.0/configuration/cgicmd.dat
    DBAUTH   /u03/apptest/FMW_11.1.1/apphome/reports/templates/rwdbauth.htm
    SYSAUTH   /u03/apptest/FMW_11.1.1/apphome/reports/templates/rwsysauth.htm
    server   rep_wls_reports_test-wam-app_wamtest1
    DIAGNOSTIC   yes
    ERRORTEMPLATE   /u03/apptest/FMW_11.1.1/apphome/reports/templates/rwerror.htm
    SERVER_IN_PROCESS   yes
    COOKIEEXPIRE   30
    ENCRYPTIONKEY   reports9i
    DIAGHEADTAGS   undefined
    DIAGBODYTAGS   undefined
    HELPURL   undefined
    RELOAD_KEYMAP   undefined
    IMAGEURL   http://09.14.4.41:8888/reports/rwservlet 
    SINGLESIGNON   no
    Oracle Reports Services - Server and Engine Environment Variables  Select to jump to the top of the page  Return to Top
    PATH   /u01/wamtest/FMW_11.1.1/apphome/jdk/bin:/u01/wamtest/FMW_11.1.1/apphome/bin:/u01/wamtest/FMW_11.1.1/apphome/jdk/bin:/u01/wamtest/FMW_11.1.1/apphome/bin:/u01/wamtest/FMW_11.1.1/apphome/bin:/u01/wamtest/FMW_11.1.1/apphome/bin:/u01/java/jdk1.6.0_23/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin
    DISPLAY  
    LD_LIBRARY_PATH   /u01/wamtest/FMW_11.1.1/apphome/jdk/jre/lib/amd64/server:/u01/wamtest/FMW_11.1.1/apphome/jdk/jre/lib/amd64:/u01/wamtest/FMW_11.1.1/apphome/jdk/jre/../lib/amd64:/u01/wamtest/FMW_11.1.1/apphome/jdk/jre/lib/amd64/native_threads:/u01/wamtest/FMW_11.1.1/apphome/jdk/jre/lib/amd64:/u01/wamtest/FMW_11.1.1/apphome/lib:/u01/wamtest/FMW_11.1.1/apphome/jdk/jre/lib/amd64/server:/u01/wamtest/FMW_11.1.1/apphome/jdk/jre/lib/amd64/native_threads:/u01/wamtest/FMW_11.1.1/apphome/jdk/jre/lib/amd64:/u01/wamtest/FMW_11.1.1/apphome/lib:/u01/wamtest/FMW_11.1.1/apphome/jdk/jre/lib/amd64/server:/u01/wamtest/FMW_11.1.1/apphome/opmn/lib:/u01/wamtest/FMW_11.1.1/apphome/lib
    ORACLE_HOME   /u01/wamtest/FMW_11.1.1/apphome
    TNS_ADMIN   /u01/wamtest/FMW_11.1.1/instance1/config
    NLS_LANG   AMERICAN_AMERICA.WE8ISO8859P1
    USER_NLS_LANG  
    RW   /u01/wamtest/FMW_11.1.1/apphome/reports
    REPORTS_PATH   /u01/wamtest/FMW_11.1.1/apphome/reports/templates:/u01/wamtest/FMW_11.1.1/apphome/reports/samples/demo:/u01/wamtest/FMW_11.1.1/apphome/reports/integ:/u01/wamtest/FMW_11.1.1/apphome/reports/printers:/u01/wamtest/FMW_11.1.1/instance1/reports/fonts:/u01/wamtest/FMW_11.1.1/apphome/reports/templates:/u01/wamtest/FMW_11.1.1/apphome/reports/samples/demo:/u01/wamtest/FMW_11.1.1/apphome/reports/integ:/u01/wamtest/FMW_11.1.1/apphome/reports/printers:/u01/wamtest/FMW_11.1.1/instance1/reports/fonts:
    REPORTS_TMP   /tmp
    REPORTS_TAGLIB_URI   /WEB-INF/lib/reports_tld.jar
    java.class.path   /u01/wamtest/FMW_11.1.1/apphome/reports/jlib/rwrun.jar
    sourceDir  
    tempDir  
    useDataCache  
    ignoreDataParameter
    =========================================================================
    ORACLE_HOME is on mount point u03, checked config.properties but no mention of mount point /u01.
    Dont know from where /u01 came. Could you please help me re configuring the env pointing to /u03.
    Reports server is up though without any issues.
    Regards,
    Djay

    Ensure that the report name is correct. Also ensure that the report exist in REPORTS_PATH environment variable. Otherwise run the report including the reports path.
    E.g.
    report=<reports directory>/test2.rdf

  • Oracle 8.1.7 in Caldera Open Unix 8 with lkp

    Hello:
    Anyone had installed Oracle 8.1.7 in Caldera Open Unix 8 with LKP (Linux Kernel Personality)?
    I've installed the software but I can't create a new database. I think there may be an operating system problem because I can't even get the startup nomount comand.
    Any help would be great.
    Thanks,
    Pablo Gomez Aguilera
    Twins Informatica

    I've install 8.1.7, 9.0.1 and 9.2 on Caldera Open Unix 8 and UnixWare 7.1.3 with LKP without any trouble.
    Check installation steps at http://www.sco.com/products/openunix/lkp/lkp_doc/LKP_oracle.html.
    Regards, Vladimir.

Maybe you are looking for

  • Unable to replicate one vendor from ECC to SRM

    Hi Gurus, We are using SRM 5.0 Classic scenario. We have scheduled the job to replicate the vendor masters from R/3 to EBP on daily basis and it is working fine and replicating the vendor master from R/3 to EBP without any issues for past two years.

  • What is a Preview in Document

    I keep seeing this option (in preferences and when saving an older iWork file). I've also notced that it is in all three iWork apps (not just pages). What does it do? How does it work? Should I use it?

  • Connecting to a Windows 2003-Server with a MacBook

    Hi guys! I'm planning on buying a MacBook anytime soon. The main purpose of this investment is work at school. Therefore I have to ensure that everything works perfectly, otherwise I would have to buy a Windows notebook (in fact not the kind of decis

  • New to Web Design/Development - Need some advice

    I have decided to start doing some web work w/ a startup company a buddy is running. The site is currently set up in Expression Engine and I personally do not like the look of it. I am a creative cloud subscriber and currently use AE, PP, Photoshop e

  • The ethernet ports suddenly stopped working on airport extreme wondering why and how to fix the problem

    I use the ethernet cable to connect my airport extreme to a linksys router to extend the network but suddenly all the ethernet cables on airport extreme stopped working and now the linksys won't get a connection. I was wondering why this might of hap