How to connect iseries green screen from java program

how to connect iseries green screen from java program to get the data in the DB files ,here the DB is DB2/400

Just some Friday fun. Use the telnet program that comes with Windows and supports VT escape sequences.
import java.io.*;
import java.net.*;
public class AutoTelnet {
     private static Socket s;
     public static void main(String[] args) throws Exception {
          Thread t = new Thread() {
               @Override public void run() {
                    try {
                         s = new ServerSocket(5555).accept();
                    } catch (IOException ex) {
                         ex.printStackTrace();
          t.start();
          Process p = new ProcessBuilder("cmd", "/C", "start", "telnet", "127.0.0.1", "5555").redirectErrorStream(true).start();
          t.join();
          PrintStream ps = new PrintStream(s.getOutputStream());
          ps.println("Screen will be cleared in 5 seconds");
          ps.println("5");
          Thread.sleep(1000);
          ps.println("4");
          Thread.sleep(1000);
          ps.println("3");
          Thread.sleep(1000);
          ps.println("2");
          Thread.sleep(1000);
          ps.println("1");
          Thread.sleep(1000);
          ps.println("\u001b[2J");
          Thread.sleep(5000);
}

Similar Messages

  • How to clear the DOS screen through java program

    how to clear the DOS screen through java program

    Just some Friday fun. Use the telnet program that comes with Windows and supports VT escape sequences.
    import java.io.*;
    import java.net.*;
    public class AutoTelnet {
         private static Socket s;
         public static void main(String[] args) throws Exception {
              Thread t = new Thread() {
                   @Override public void run() {
                        try {
                             s = new ServerSocket(5555).accept();
                        } catch (IOException ex) {
                             ex.printStackTrace();
              t.start();
              Process p = new ProcessBuilder("cmd", "/C", "start", "telnet", "127.0.0.1", "5555").redirectErrorStream(true).start();
              t.join();
              PrintStream ps = new PrintStream(s.getOutputStream());
              ps.println("Screen will be cleared in 5 seconds");
              ps.println("5");
              Thread.sleep(1000);
              ps.println("4");
              Thread.sleep(1000);
              ps.println("3");
              Thread.sleep(1000);
              ps.println("2");
              Thread.sleep(1000);
              ps.println("1");
              Thread.sleep(1000);
              ps.println("\u001b[2J");
              Thread.sleep(5000);
    }

  • How to Acess a C fuction from Java Program

    Hi
    I want to write a 'C' PRogram which will recognize the newely connected USB port .Please Suggest me the header files required for the C Program. and Where they are.
    Then I have to Call the 'C' Function From a java Program.
    I want the Process for this entire scenario.
    Thanks
    Madhu

    Hi,
    You have a good start at http://jusb.sourceforge.net/?selected=api
    --Marc (http://jnative.sf.net)                                                                                                                                                                                                               

  • How to call a perl module from Java program.

    Hi,
    I create a simple java program as follows
    class test{
    public static void main(String args[])
    {try {                    
    Runtime r = Runtime.getRuntime();
    r.exec("perl test.pl");
    catch(Exception e)
    {e.printStackTrace();}
    and test.pl is located in the same directory as the java program. The program compiles but with no return as I execute it. I am not sure what is wrong.
    Thanks,

    I think the wrong line is here; r.exec("perl test.pl");
    Usually the JVM needs the full path.If the path for either the executable or the script was wrong then, given the code posted, it would not hang.
    >
    To automatticaly get the path (if the file is in the
    class path) use
    System.getProperty("java.class.path")
    That gets paths(plural).
    Try this:
    r.exec("perl " +
    System.getProperty("java.class.path") + "\test.pl");I am rather certain that that won't work on any standard operating system.

  • How to connect yahoo Api through a java program

    Dear All,
    I have problem in my java program. i have created two text field one is for username and another is for password.when we will give a yahoo id in one textfield and after that we will give the yahoo password in the other textfield. It will directly go to the yahoo server and collect all the friend lists which we have get in our program.please anybody tell me in this regards.
    Thanks and Regards
    Abhiram Sahoo.

    Which one? The one full of SPAM, my work address, or my one I use for my personal account?
    I think on my SPAM account, I'm down to less than 200 a day, I'll hve to go try to win that 54 inch Sharp Auquos again.

  • How to Connect to Mysql databse from Java Studio Enterprise 8

    Hello everybody,
    I have a database in mysql in linux.I have downloaded Java Studio Enterprise 8.
    How is it possible to connect to mysql.
    Could you tell the procedure .., I would be really thankfull
    From
    Ranjitha Rao

    hi
    u can connect to Mysql with the following code
    Class.forName("com.mysql.jdbc.Driver");
                   String url1 = "jdbc:mysql://localhost/<database name>";
                   String user1 = "root";
                   String pass1 = "";
                   Connection con1=DriverManager.getConnection(url1, user1, pass1);

  • How to capture Wnidows(OS) event from Java program

    Hi,
    I am developing one application , in that if the user didn't do any thing in 15 mins,i need to log out from my application(not windows).Here i need to check Java event as weel as windows(OS) events also.Any one knows how to capture the OS events??

    I want to know the status of mouse and keyboard(Windows 2000).If the status of the mosue or keyboard doesn't change from 15min i need to log of the java application.

  • How to change a date value from "java.util.Date" to "java.sql.Date"?

    Hi all,
    How to change a date value from "java.util.Date" to "java.sql.Date"?
    I m still confusing what's the difference between them.....
    thanks
    Regards,
    Kin

    Thanks
    but my sql statement can only accept the format (yyyy-MM-dd)
    such as "select * from xx where somedate = '2004-12-31'
    but when i show it to screen, i want to show it as dd-MM-yyyy
    I m using the following to change the jave.util.Date to str and vice versa. But it cannot shows the dd-MM-yyyy. I tried to change the format from yyyy-MM-dd to dd-MM-yyyy, it shows the wrong date in my application.
         public String date2str(java.util.Date thisdate)     {
              if (thisdate != null)     {
                   java.sql.Date thissDate = new java.sql.Date(thisdate.getTime());
                   return date2str(thissDate);
              }     else     {
                   return "";
         public String date2str(java.sql.Date thisdate)     {
              if (thisdate != null)     {
                   SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
                   return sdf.format(thisdate);
              }     else     {
                   return "";
         public java.util.Date str2date(String thisdate)     {
              String dateFormat = "yyyy-MM-dd"; // = 1998-12-31
              java.util.Date returndate = null;
              if (thisdate != null)     {
                   SimpleDateFormat dateFormatter = new SimpleDateFormat(dateFormat);
                   try {
                        returndate = dateFormatter.parse(thisdate);
                   } catch (ParseException pe) {
                        System.out.println (pe.getMessage());
              return returndate;
         }

  • How to connect to  Oracle database from webdynprojava application

    Hi
    How to connect to  Oracle database from webdynprojava application. where can we provide the code to connect to database.?
    Thank You.

    Hi,
    You need to create  Java Bean model. The bean is a typical java bean with default constructor, getter and setter. You can have additional methods for query etc. The attributes in the class will be your model node and attributes.
    However you need to configure the connection and create JNDI using visual administrator before writing the code.
    You can also consider writing Session EJB with oracle and using them in WD.
    http://help.sap.com/saphelp_nwce10/helpdata/en/45/dcaa4f05535591e10000000a1553f7/frameset.htm
    Srini

  • Can anybody tell me how to send/receive  the sms from java application

    Hi All,
    Can any body tell me, how to send/receive the sms from java application to mobile phones.
    I have installed the jsms engine and when i try to connect to the mobile device ,the jsms server is giving
    the following error.
    Cannot connect to GSM Device, error : -11

    Which jsms? Google finds several.
    Try the website where you downloaded it.

  • Can any body tell me, how to send/receive the sms from java application

    Hi All,
    Can any body tell me, how to send/receive the sms from java application to mobile phones.
    I have installed the jsms engine and when i try to connect to the mobile device ,the jsms server is giving
    the following error.
    Cannot connect to GSM Device, error : -11

    The best place to ask your question is at the JSMS website, forum or mailing list since this is no error that directly comes from a class belonging to the core Java classes.

  • Removing green screen from a video sequence in PS

    How can I remove the green screen from a video sequence in Photoshop?

    There's a bunch of tutorials for editing video with Photoshop on Adobe TV
    http://tv.adobe.com/watch/photoshop-for-video/chroma-keying-backdrops/
    I am not sure if the above link is going to help you though.  Is this footage you shot yourself?  If so what sort of camera, and how was the BG lit?  I ask as chroma keying can be tricky to get right, and I understand that DSLR footage is far from ideal for chroma key for instance.  I use a Canon XF300 which records with a 50mb/s 4:2:2 codec, which works well for chroma key.

  • How do i stop the screen from rotating on my iphone

    how do i stop the screen from rotating on my iphone when i move the phone from horizontal to vertical

    You can lock your screen from rotating. Double-click the home button, then slide your finger to the right until your get to the iPod section. There you click the icon on the left and that will lock your screen. You can unlock it the same way.

  • How to call a VB application from Java

    Hi,
    does anybody know how to call a VB application from java.
    Would appreciate if you can provide me with an example.
    thanks

    try exec()ing the cad program with the name of the file as a command line parameter...
    Runtime.getRuntime().exec("CADProg.exe Test.prt");
    i have no clue if this will work but it seems like it's worth a try.

  • How to call a .bat file from java code?

    How to call a .bat file from java code? and how can i pass parameters to that .bat file?
    Thanks in advance

    thanks for ur reply
    but still i am getting the same error.
    I am trying to run a .bat file of together tool, my code looks like below
    import java.lang.Runtime;
    import java.lang.Process;
    import java.io.File;
    class SysCall{
         public static void main(String args[]){
              String cmd="D://Borland//Together6.2//bin//Together.bat -script:com.togethersoft.modules.qa.QA -metrics out:D://MySamples//Metrics// -fmt:html D://Borland//Together6.2//samples//java//CashSales//CashSales.tpr";
              //String path="D://Borland//Together6.2//bin//Together.bat ";
              Runtime r= Runtime.getRuntime(); //Declare the system call
              try{
                   System.out.println("Before batch is called");
                   Process p=r.exec(cmd);
                   System.out.println(" Exit value =" + p.exitValue());
                   System.out.println("After batch is called");
              /*can produce errors which must be caught*/
              catch(Exception e) {
                   e.printStackTrace();
                   System.out.println (e.toString());
    I am getting the below exception
    Before batch is called
    java.lang.IllegalThreadStateException: process has not exited
    at java.lang.Win32Process.exitValue(Native Method)
    at SysCall.main(SysCall.java:17)
    java.lang.IllegalThreadStateException: process has not exited

Maybe you are looking for

  • Background scheduling in BAPI

    REPORT  ZIND_BACKGROUND_JOB MESSAGE-ID zsd                                     NO STANDARD PAGE HEADING                                     LINE-SIZE 160. Tables TABLES: mara,mvke. Data Definitions. TYPES: BEGIN OF ty_mat,          matnr     TYPE mar

  • Problem with audio unit

    Hi, i've got some troubles with logic! Logic can't find my audio units, i've got a message which told me about midi delays issues(it's in french so i'm not sure about the translation)! I tried to reinstall it, but it's still blocked.....i don't know

  • ACR with 32-bit tiffs?

    I ran a set of HDR images through Merge to HDR Pro.  Saved the result as a 32-bit tiff.  Back to Bridge 6.0.1.6 where I can see the tiff. I now want to do the RAW processing on the HDR file in ACR.  I have no "Open in camera RAW". I can open .NEF, .j

  • Where is google sync in the BB Curve 8520?

    Can't get my calendar to Sync.  Just got the Curve 8520 last night and it actually seems to have a lot LESS flexibility and options than the 8350.  Still getting used to it, but wondering if I made a mistake? How do I sync my calendar on this new pho

  • OIM LDAP connector for internal WebLogic LDAP?

    Has anyone ever used OIM to manage internal LDAP for WebLogic?  I'm considering it for compliance reasons.