Working Code from Unix Command, needs fixing!

/* Codes needs modification to run and display in GUI, will run and produce output in terminal, but will not display in GUI with setText and getText */
import java.io.*;
import java.awt.*;
import javax.swing.*;
import javax.swing.border.*;
public class UnixCommand extends JFrame
private JComboBox comboBox;
private JTextArea displayArea;
private JPanel mainPanel, displayPanel, comboPanel;
private String names[] = { "Check Processes", "Check Network Connectivity",
                    "Check Remote Users", "Check Share Devices" };
TitledBorder selectBorder, displayBorder;
public UnixCommand()
     super( "Unix Command Tools in GUI" );
     Container container = getContentPane();
     mainPanel = new JPanel( new BorderLayout() );
     container.add( mainPanel );
     displayPanel = new JPanel();
     comboPanel = new JPanel();
          mainPanel.add( displayPanel, BorderLayout.CENTER );
          mainPanel.add( comboPanel, BorderLayout.NORTH );
               comboBox = new JComboBox( names );
               comboBox.setMaximumRowCount( 3 );
               comboPanel.add( comboBox );
                    selectBorder = BorderFactory.createTitledBorder( "Select the Task to Perform" );
                    selectBorder.setTitlePosition( TitledBorder.TOP );
                    comboPanel.setBorder( selectBorder );     
               displayArea = new JTextArea( 22, 40 );
               displayPanel.add( displayArea );
                    displayBorder = BorderFactory.createTitledBorder( "The Command Output Selected" );
                    displayBorder.setTitlePosition( TitledBorder.BOTTOM );
                    displayPanel.setBorder( displayBorder );
String s = null;
     displayArea.setText("\tHere is the standard output of the command:\n");
try
                         // run the Unix "ps -ef" command
Process p = Runtime.getRuntime().exec("ps -ef");
BufferedReader stdInput = new BufferedReader(new
InputStreamReader(p.getInputStream()));
BufferedReader stdError = new BufferedReader(new
InputStreamReader(p.getErrorStream()));
                    // read the output from the command
System.out.println("Here is the standard output of the command:\n");
while ((s = stdInput.readLine()) != null)
System.out.println(s);
                    // read any errors from the attempted command
System.out.println("Here is the standard error of the command (if any):\n");
while ((s = stdError.readLine()) != null)
System.out.println(s);
System.exit(0);
catch (IOException e)
     System.out.println("exception happened - here's what I know: ");
     e.printStackTrace();
     System.exit(-1);
setSize( 500, 500 );
setVisible( true );
public static void main( String args[] )
     UnixCommand application = new UnixCommand();
     application.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
}

All files are regenerated if changed.
That goes for the .java and the .class files that are created. The jsp server checks to see if the current version is the latest. If it is, nothing gets changed or recompiled. If things are different, programs are recompiled.
Youll notice that if you have a new jsp it always takes longer the first time. Or even when you change a jsp, the first time takes the longest for the page to come up in a browser. This is because of recompiling.
Does this make any sense?
Adam

Similar Messages

  • Is it possible to fire an ibot from unix command line?

    Hi,
    Is it possible to fire an ibot from unix command line?
    I am looking to setup a setp in a job in grid control which runs a report in order to create a cached file on the obiee server once a prior step has completed. Is this possible?

    Hi,
    Did you check this?
    is it possible to execute ibot..
    Rgds,
    Dpka

  • Using magicjack on a mac it wont work support from MJ could not fix problem

    using magicjack on a mac it wont work support from MJ could not fix problem

    Sorry about lack of info it wont boot up at all they logged on to my computer to try and fix it but everthing they tried failed ,they formatted  did something with  java  and changed some setting  i was thinking maybe it has to with the my Mac   for some help

  • Return codes from sqlldr command from unix shell script

    I am trying to capture error code from sql loader from unix shell script and display proper messages.
    sqlldr parfile=sdb.par control=$cntlfile data=$infile bad=$badFile log=$logFile rows=10000
    rows=10000
    retcode=`echo $?`
    case "$retcode" in
    0) echo "SQL*Loader execution successful" ;;
    1) echo "SQL*Loader execution exited with EX_FAIL, see logfile" ;;
    2) echo "SQL*Loader execution exited with EX_WARN, see logfile" ;;
    3) echo "SQL*Loader execution encountered a fatal error" ;;
    *) echo "unknown return code";;
    esac
    Eventhough, there are errors while executing sqlldr, it is always returing recode zero. What could be the possible reason
    Please advice

    Is there a typo in your code ?
    sqlldr parfile=sdb.par control=$cntlfile data=$infile bad=$badFile log=$logFile rows=10000
    rows=10000
    retcode=`echo $?` In this code, you get the return code of the statement in bold which is not the sqlldr statement ...

  • How to compile and deploy JSP code from Unix server command line?

    I am new to JSP technology. We are thinking to modify some of JSP code to meet our need. But I am not sure what I should do after I change JSP code. How can I compile the changed code? How to deploy? How to publish on the web?

    All files are regenerated if changed.
    That goes for the .java and the .class files that are created. The jsp server checks to see if the current version is the latest. If it is, nothing gets changed or recompiled. If things are different, programs are recompiled.
    Youll notice that if you have a new jsp it always takes longer the first time. Or even when you change a jsp, the first time takes the longest for the page to come up in a browser. This is because of recompiling.
    Does this make any sense?
    Adam

  • Requesting user input from UNIX command window

    New to this forum, and relatively new to Java......question for you......
    Currently, I am able to request a .txt file from a user in my unix command window by having them type in the following command:
    java Game (nameOfTextFile).txt
    with the following code:
    public class Game {
    public static void main(String[ ] args) {
    try{
    reader = args[0];
    catch(Exception g){
    System.out.println(g);
    where 'reader' holds the .txt file.
    What I would like to do is as soon as the user types in the command:
    java Game
    it gives them the line:
    "Please type the file to be input"
    and at this point they type in:
    (nameOfTextFile).txt
    and then I can start working with the text file.
    Any ideas?
    Thanks

    public class Game {
    public static void main(String[ ] args) {
    try{
    reader = args[0];
    catch(Exception g){
    System.out.println(g);
    }This class will not compile. The variable 'reader' is not declared anywhere.
    You could create a shell program. When the user enters the name of the shell program at the command prompt, it gives them the prompt to enter the file to be input. And then from within the shell program you call the java program with the name of the file.

  • How to run Discoverer 10g report from unix command line

    Hello Experts,
    I am aware that discoverer report can run through command line using "dis51usr.exe /connect username/passward@connection_string /opendb "DISCOVERER.<<report name>> /export xls"".
    Can we run discoverer 10g report (stored in database) from server location / unix command line? Is there any command?
    Please assist. Thank you.

    Hi Tamir,
    Can you please mention from where we have to execute/run these commands? After setting enviornmental variable, are these commands run from any location or we have to go to particular server location and then execute (ex. from directory BI or else).
    Thank you.

  • Capture return code from system command?

    Can someone please tell me what is the easiest way to capture the return code when executing a system command?
    In other words I wish to execute a say a perl script and capture the return code from it.
    Any help is appreciated.

    Process p = Runtime.getRuntime().exec("blah.exe");
    p.waitFor();
    System.out.println("Return code from blah.exe"+ p.exitValue());

  • Return code from Client_host command

    Hi,
    Is it possible to get the return code from the os when I issue the webutil Client_Host procedure?
    Thanks,
    Mary

    Mary
    You can use the WEBUTIL_HOST.HOST method instead of CLIENT_HOST. It is overloaded as both a Procedure and a function; the latter returns the client return code.
    Cheers, APC

  • SAP related UNIX commands needed.

    Dear All,
    I am new to unix environment, we have HPUX OS.
    Please provide me frequently used Unix commands related to SAP.or document please send it to me at [email protected] or paste it here.
    appreciate your early response.
    Regards,
    SM

    Hi again. The commands like ps -ef or grep is not special commands for SAP,it's commands for HP-UX, you can read
    about him on HP forums or HP documents...
    The links -->
    1) Technical documentation http://docs.hp.com/
    2) Online help - home http://www12.itrc.hp.com/service/help/onlineHelpHome.do?admit=109447627120628628184728353475
    3) Forums --> hp-ux technical documentation
    http://forums11.itrc.hp.com/service/forums/categoryhome.do?categoryId=475
    If you interest some commands only run search on the HP forum.
    Regards. Award if helpful.

  • Unix Command Needed

    I would like to format a SATA drive that is connected with a USB adapter, but I am unsure how to do it without overwriting my internal drive.
    diskutil resizeVolume disk0s2 200G "JHFS+" 4-Linux 30G "MS-DOS FAT32" 4-Windows 0b
    The command above was copied from another forum. I couldn't remember if it has a typo that needs to be fixed (0b to 0G?).
    I assume that disk0s2 needs to be changed, but I cannot figure out what my external drive would be named. Please advise.

    diskutil resizeVolume disk1s3 200G "JHFS+" 4-Linux 30G "MS-DOS FAT32" 4-Windows 0b
    Thanks, that worked perfectly!
    This worked, but I now see that UNIX was not needed to make it happen. I'm stumped why so many forums regarding triple booting a Mac don't use Disk Utility instead of UNIX. Not to mention, I found one that had bad syntax, and I had to keep searching to find one that worked.
    The Linux partition was formatted in Mac OS Extended Journaled. Linux must be able to see the partition when installing, and then it probably reformats to a non-Apple scheme before installation begins. Since it cannot be mounted by OS X when booting into X, it may be defaulting to ext3 format. In Disk Utility, it shows up as disk0s3, and it is grayed out.

  • Problem starting a scenario from Unix command line

    Hello all, many apologies if this is the wrong section of the forum, if it is and you could direct me to the right section I'd be grateful.
    If you're still reading and I am in the right section, I have a problem when using the startscen.sh script to start a scenario.
    This is what appears to be the relevant part of the log, I've had to change some values in the output for our security people.
    lots of java
    FirstUser:SUNOPSIS_INSTALL
    IndChange:I
    IntJavaName:com.sunopsis.dwg.dbobj.SnpRemRep
    IObjects:4600
    LastDate:2010-07-20 11:08:31.0
    LastUser:SUNOPSIS_INSTALL
    ObjName:OBJ_SNPREMREP_4600
    SecuPos:110]
    java.lang.NullPointerException
    08/18/2010 01:53:04 PM(main): SnpsConnection : disconnect : DbUrl : jdbc:oracle:thin:<our host and port data> : User : <our user> : ConnectID : INTERNAL_MASTER0
    08/18/2010 01:53:04 PM(main): SnpsConnection : disconnect : After ConnectionLst :
    DwgJv.main: Exit. Return code:-1
    OracleDI: Starting scenario PKG_PROCESS_FILES 001 in context Global ...
    08/18/2010 01:53:05 PM(main): DwgCmd: getUniqueThreadIdentifier : :Before : mThreadIDIncrementCounter : 0
    08/18/2010 01:53:05 PM(main): DwgCmd: getUniqueThreadIdentifier : :After : mThreadIDIncrementCounter : 1 : Unique ID : 0
    08/18/2010 01:53:06 PM(main): DwgTaskSql.supportTransactions : test transactions capability for :
    Oracle JDBC driver
    10.1.0.5.0
    08/18/2010 01:53:06 PM(main): DwgTaskSql.supportTransactions : test transactions capability for :
    Oracle JDBC driver
    10.1.0.5.0
    08/18/2010 01:53:06 PM(main): SnpsQuery.updateExecStatement : prepare request :
    Select BATCH_UPDATE_SIZE, CONNECT_TYPE, CON_NAME, DSERV_NAME, FETCH_ARRAY_SERV, FIRST_DATE, FIRST_USER, IND_JNDI, I_CONNECT, I_HOST, I_TECHNO, I_TXT_JAVA_URL, I_TXT_JNDI_URL, I_TXT_WS_BASE_URL, JAVA_DRIVER, JNDI_AUTHENT, JNDI_FACTORY, JNDI_PROTO, JNDI_PWD, JNDI_RESSOURCE, JNDI_USER, LAST_DATE, LAST_USER, PASS, USER_NAME, WS_DEPLOY_MODE from SNP_CONNECT where SNP_CONNECT.I_CONNECT=?
    08/18/2010 01:53:06 PM(main): SnpsQuery.updateExecStatement : prepare request :
    Select FIRST_DATE, FIRST_USER, I_CONNECT, LAST_DATE, LAST_USER, REP_ID, REP_NAME, REP_TIMESTAMP, REP_TYPE from SNP_REM_REP where REP_NAME = ?
    08/18/2010 01:53:06 PM(main): SnpRemRep.getObjectLst : :
    08/18/2010 01:53:06 PM(main): SnpsQuery.updateExecStatement : prepare request :
    Select AGENT_NAME, AGENT_NAME2, EXT_VERSION, FIRST_DATE, FIRST_USER, HOST_NAME, HOST_PORT, IND_CHANGE, I_AGENT, LAST_DATE, LAST_USER, MAX_THREAD from SNP_AGENT where AGENT_NAME=?
    08/18/2010 01:53:06 PM(main): SnpAgent.getObjectLst : :
    [AgentName:@
    AgentName2:null
    ExtVersion:null
    FirstDate:2010-06-22 17:47:34.0
    FirstUser:SUPERVISOR
    HostName:<out host>
    HostPort:<our port>
    IndChange:U
    IAgent:1000
    LastDate:2010-06-23 12:40:32.0
    LastUser:SUPERVISOR
    MaxThread:1000]
    08/18/2010 01:53:06 PM(main): SnpsQuery.updateExecStatement : prepare request :
    Select AUT_SUPERVISOR, EXPIRACY_DATE, EXT_VERSION, FIRST_DATE, FIRST_USER, IND_CHANGE, I_TXT_DETAIL, I_WUSER, LAST_DATE, LAST_USER, PASS, USER_EXPIRACY_DATE, WUSER_INIT, WUSER_NAME from SNP_USER where WUSER_NAME=?
    08/18/2010 01:53:06 PM(main): SnpUser.getObjectLst : :
    [AutSupervisor:1
    ExpiracyDate:null
    ExtVersion:null
    FirstDate:2010-06-21 08:22:32.0
    FirstUser:SUNOPSIS_INSTALL
    IndChange:I
    ITxtDetail:null
    IWuser:1999
    LastDate:2010-06-21 08:24:44.0
    LastUser:SUNOPSIS_INSTALL
    Pass:hZyX6tylA1y5R.RcRlQdfp
    UserExpiracyDate:null
    WuserInit:SU
    WuserName:SUPERVISOR]
    08/18/2010 01:53:06 PM(main): SnpsQuery.updateExecStatement : prepare request :
    Select EXT_VERSION, FIRST_DATE, FIRST_USER, IND_CHANGE, INT_JAVA_NAME, I_OBJECTS, LAST_DATE, LAST_USER, OBJ_NAME, SECU_POS from SNP_OBJECT
    08/18/2010 01:53:06 PM(main): SnpObject.getObjectLst : :
    [ExtVersion:null
    FirstDate:2010-06-21 08:21:48.0
    FirstUser:SUNOPSIS_INSTALL
    IndChange:I
    lots of java
    If anyone could shed some light I would be very grateful.
    izz

    Fantastic! Thankyou for your help. I realise my problem was that I copied jdic.jar into the project folder to save effort, but forgot tray.dll. I had seen tray.dll in that error output, but simply hadn't made the connection - you know how it is after staring at the same problem for a whole evening!
    As it is, I only had to copy tray,dll into the project folder and it works fine. :D.
    Thanks a lot.

  • Launch background process from unix command line and detect if it is runnin

    in Cocoa, I am able to run unix app by using NSTask, it works fine to me. But I want to do the following:
    1. Start up a background process.
    2. Wait to see if this background process has been launched correctly.
    3. If yes, keep running following codes...
    With NSTask, I cannot make sure when the background process has been launched correctly... and other codes just keep running...
    If I do something like:
    while (bgprocess isRunning)
    }

    What exactly do you mean by "launched correctly"? Do you just care that the process has begun? Do you want to make sure it is still running? Do you want to see if there is some signal emitted (either affirmative "I am running" or absence of a child-died signal)?
    Your isRunning example does appear to be in accord with the NSTask docs for "do blah blah blah while the task is running", but that doesn't seem to be what your description says you want to do. Is "blah blah blah" an idle loop until the task has started, or is it something to do while the task is actually running?
    How about looking up the pid of the child process (processIdentifier for the NSTask) and then check whether that process is still running?

  • Unix command needed to search alert log

    Hi. Im trying to search the alert log file to see if there is any thing related to the checkpointing process.
    Specifically Im looking for anything that includes "Checkpoint not complete".
    If anyone knows the command for searching the file in UNIX for this then please post here!
    Many thanks
    DA

    Hi Dan,
    "Checkpoint not complete".In UNIX try: http://www.dba-oracle.com/op_unix_16_cat_grep_commands.htm
    grep "checkpoint not complete" /u01/app/..../alertSID.log
    In Windows:
    http://www.dba-oracle.com/t_windows_alert_log_script.htm
    I e-mail myself important alert log messages, using this technique:
    http://www.remote-dba.cc/oracle_tips_table_alerts.htm
    Also, you can read the alert log from SQL, if you want:
    http://www.dba-oracle.com/t_oracle_alert_log_sql_external_tables.htm
    Hope this helps. . .
    Donald K. Burleson
    Oracle Press author
    Author of "Oracle Tuning: The Definitive Reference":
    http://www.dba-oracle.com/bp/s_oracle_tuning_book.htm

  • How to move any xml from unix server to SVN trunk

    Hi All,
      I have made an ODI package to move the code from odi work repo to unix server in folders. Now I need to push this code from Unix to SVN. How should I do this ?
      Any unix commands or ODI tools ? Please suggest.
    Regards,
    Rishi

    Hi Rishi,
    I've not done it myself, but I'm guessing you would need to use the SVN API to push the XML to SVN. Looks like it will allow you to use proper change management functionality. https://subversion.apache.org/docs/javahl/latest/
    Good luck!
    Regards,
    Michael Rainey

Maybe you are looking for

  • Internal Errror when saving as a png

    Hello, I use Fireworks to create a map with some special information. I have three layers, one contains the map itself (3 pictures), one contains a lot of circles (vectors, round about 40) and the third contains the additional text. Till now everythi

  • How do i stop sharing from my ipad to my wifes computer and only to my mac"

    My ipad thru icloud is sharing the information on my wifes macbook including my contact lists, and apps.  I also have an Imac that the ipad shares with how can I stop sharing to my wifes Macbook?

  • Error when calling an external web service (blank soap action)

    I did a lot of searching on this message and did not find an answer. Most of the issues i found related to XI/PI, which we are not using. There is a web service created outside of SAP for which i generated (from the WSDL) a proxy class in my DEV syst

  • 3D Widgets and Contact with Dev Team

    Hi there folks, Top Of The Mornin' from a new member of the iBooks Author community based in Ireland. My company has just uploaded an iBook to the store, and are awaiting approval for the various markets. When we initially installed iBooks Author, we

  • Can we create range variable for Query Key Date

    Hello Gurus, Can we create a range variable for Query Key Date ? when I tried to give a range of values for Query Key Date, I am unable to find Range Values option. I found only Single Values. so, Please let me know if we can use Range variables for