Urget Help --- Please give me the core java code that connects to UNIX ser

Can anyone provide the core java code that connects UNIX server after verifying credentials and allow to implements UNIX commands through java program?

no, you don't want to do that.
You want to connect yourself, which Java is quite capable of doing, rather than go through some 3rd party client program that's not only specific to a particular operating system but not guaranteed to be installed at any particular machine or if it is to be installed in such a way that you can start it from your Java program.
And then there's the little matter of figuring out the external API to use that program in the way you intent to (if it has one).

Similar Messages

  • Please help me in compiling the enclosed java code

    Iam trying to compile the below mentioned java code and iam getting this error: I have Weblogic 6.1 + sp2 installed on my machine. Please help !
    The error is :
    C:\bea\jdk131>javac Browser.java
    Browser.java:17: cannot resolve symbol
    symbol : class JIconButton
    location: class Browser
    private JIconButton homeButton;
    ^
    Browser.java:25: cannot resolve symbol
    symbol : class ExitListener
    location: class Browser
    addWindowListener(new ExitListener());
    ^
    Browser.java:26: cannot resolve symbol
    symbol : variable WindowUtilities
    location: class Browser
    WindowUtilities.setNativeLookAndFeel();
    ^
    Browser.java:30: cannot resolve symbol
    symbol : class JIconButton
    location: class Browser
    homeButton = new JIconButton("home.gif");
    ^
    4 errors
    THE CODE IS HERE :
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.net.*;
    import java.io.*;
    public class Browser extends JFrame implements HyperlinkListener,
    ActionListener {
    public static void main(String[] args) {
    if (args.length == 0)
    new Browser("http://www.apl.jhu.edu/~hall/");
    else
    new Browser(args[0]);
    private JIconButton homeButton;
    private JTextField urlField;
    private JEditorPane htmlPane;
    private String initialURL;
    public Browser(String initialURL) {
    super("Simple Swing Browser");
    this.initialURL = initialURL;
    addWindowListener(new ExitListener());
    WindowUtilities.setNativeLookAndFeel();
    JPanel topPanel = new JPanel();
    topPanel.setBackground(Color.lightGray);
    homeButton = new JIconButton("home.gif");
    homeButton.addActionListener(this);
    JLabel urlLabel = new JLabel("URL:");
    urlField = new JTextField(30);
    urlField.setText(initialURL);
    urlField.addActionListener(this);
    topPanel.add(homeButton);
    topPanel.add(urlLabel);
    topPanel.add(urlField);
    getContentPane().add(topPanel, BorderLayout.NORTH);
    try {
    htmlPane = new JEditorPane(initialURL);
    htmlPane.setEditable(false);
    htmlPane.addHyperlinkListener(this);
    JScrollPane scrollPane = new JScrollPane(htmlPane);
    getContentPane().add(scrollPane, BorderLayout.CENTER);
    } catch(IOException ioe) {
    warnUser("Can't build HTML pane for " + initialURL
    + ": " + ioe);
    Dimension screenSize = getToolkit().getScreenSize();
    int width = screenSize.width * 8 / 10;
    int height = screenSize.height * 8 / 10;
    setBounds(width/8, height/8, width, height);
    setVisible(true);
    public void actionPerformed(ActionEvent event) {
    String url;
    if (event.getSource() == urlField)
    url = urlField.getText();
    else // Clicked "home" button instead of entering URL
    url = initialURL;
    try {
    htmlPane.setPage(new URL(url));
    urlField.setText(url);
    } catch(IOException ioe) {
    warnUser("Can't follow link to " + url + ": " + ioe);
    public void hyperlinkUpdate(HyperlinkEvent event) {
    if (event.getEventType() ==
    HyperlinkEvent.EventType.ACTIVATED) {
    try {
    htmlPane.setPage(event.getURL());
    urlField.setText(event.getURL().toExternalForm());
    } catch(IOException ioe) {
    warnUser("Can't follow link to "
    + event.getURL().toExternalForm() + ": " + ioe);
    private void warnUser(String message) {
    JOptionPane.showMessageDialog(this, message, "Error",
    JOptionPane.ERROR_MESSAGE);

    I got this code from this forum concerning MONITORING some application. Iam working on writing something which can monitor the availabilty of my application on the browser. Iam not familiar with swings so i got confused with compiling this code.
    Please let me know if you know some code that can help me monitor my web based application.
    Thanks in advance.

  • Java code to connect to unix box(putty)

    i'm having a great problem regarding accessing the putty box from java code.
    I need to read some log files from unix through java code.In my client program when i'm giving hostname and port=22...ssh terminal is getting detected,but i'm confused how to open that unix box by giving the username and password.and how am i goin to embed unix command in it.The entire job i've to do through java code.
    please help!!..Thanks
    Message was edited by:
    liz310
    Message was edited by:
    liz310

    thanks a lot guys for ur time...but i tried in every way..i'm getting hell lot of errors..please help..its really urgent
    /*this is my code:*/
    import com.jcraft.jsch.*;
    import com.jcraft.jsch.Channel;
    import com.jcraft.jsch.JSch;
    import com.jcraft.jsch.JSchException;
    import com.jcraft.jsch.Session;
    import com.jcraft.jsch.UserInfo;
    import java.io.*;
    public class shell_test {
    public static void main(String args[])
    String user="user15";
    String host="punlin040";
    String cmd="ls -l";
    JSch jsch = new JSch();
    try{
    Session session=jsch.getSession(user,host,22);
    session.setPassword("user15");
    //UserInfo usrInfo=new MyUserInfo();
    //session.setUserInfo(usrInfo);
    session.connect();
    Channel channel=session.openChannel("exec");
    ((ChannelExec) channel).setCommand(cmd);
    channel.setXForwarding(true);
    channel.connect();
    //code
    channel.setInputStream(System.in);
    // channel.setOutputStream(System.out);
    //((ChannelExec) channel).setErrStream(System.err);
    InputStream in = channel.getInputStream();
    channel.connect();
    byte[] tmp = new byte[1024];
    while (true)
    while (in.available() > 0)
    int i = in.read(tmp, 0, 1024);
    if (i < 0)
    break;
    System.out.print(new String(tmp, 0, i));
    if (channel.isClosed())
    in.close();
    // System.out.println("JSCH: exit-status: " +
    //channel.getExitStatus());
    break;
    try
    Thread.sleep(1000);
    catch (Exception ee)
    channel.disconnect();
    session.disconnect();
    //code
    //ch.setInputStream(System.in);
    //ch.setOutputStream(System.out);
    }catch(Exception e)
    {e.printStackTrace(); }
    /*public static class MyUserInfo implements UserInfo {
    public String getPassword()
    { return "password"; }
    public String getPassphrase()
    { return ""; }
    public boolean promptPassword(String arg0)
    { return true; }
    public boolean promptPassphrase(String arg0)
    { return true; }
    public boolean promptYesNo(String arg0)
    { return true; }
    public void showMessage(String arg0)
    but i'm getting following errors:
    com.jcraft.jsch.JSchException: java.lang.ClassNotFoundException: com.jcraft.jsch
    .jce.Random
    at com.jcraft.jsch.Session.connect(Session.java:160)
    at com.jcraft.jsch.Session.connect(Session.java:145)
    at shell_test.main(shell_test.java:25)
    Caused by: java.lang.ClassNotFoundException: com.jcraft.jsch.jce.Random
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at com.jcraft.jsch.Session.connect(Session.java:156)
    ... 2 more

  • Can you please give me the details of Archiving object for Reservations

    Hi All,
    Could you please give me the details of Archiving object for Reservation documents. If there is no standard object can you please give me the details, for which program we are using.
    Regards,
    Ram

    Hi,
    You do not need to configure the tables to be deleted for any archive object through AOBJ. SAP would have maintained the list of tables from which data will be deleted if you archive a particular object. In case of archiving MM_EKKO, data will be deleted from many other tables apart from EKKO and EKPO. Here is the list of tables from which data will be delete if you archive PO using MM_EKKO.
    A068
    A081
    A082
    A215
    ADR10
    ADR11
    ADR12
    ADR13
    ADR2
    ADR3
    ADR4
    ADR5
    ADR6
    ADR7
    ADR8
    ADR9
    ADRCOMC
    ADRCT
    ADRG
    ADRGP
    ADRT
    ADRU
    ADRV
    ADRVP
    AUSP
    CDCLS
    CDHDR
    CDPOS_STR
    CDPOS_UID
    CMFK
    CMFP
    DJEST
    EIKP
    EIPO
    EKAB
    EKBE
    EKBEH
    EKBZ
    EKBZH
    EKEH
    EKEK
    EKES
    EKET
    EKETH
    EKKN
    EKKO
    EKPA
    EKPO
    EKPV
    EKUB
    EREV
    ESKL
    ESKN
    ESLH
    ESLL
    ESSR
    ESUC
    ESUH
    IBADDR
    IBIB
    IBIBOBS
    IBIBT
    IBIN
    IBINDOMAINS
    IBINOBS
    IBINOWN
    IBINT
    IBINTX
    IBINVALUES
    IBSP
    IBST
    IBSTREF
    IBSYMBOL
    INOB
    JCDO
    JCDS
    JEST
    JSTO
    KAPOL
    KOCLU
    KONH
    KONM
    KONP
    KONW
    KSSK
    MLBE
    MLBECR
    MLWERE
    NAST
    RESB
    STXB
    STXH
    STXL
    WRF_PSCD_DLHD
    WRF_PSCD_DLIT
    WRF_PSCD_DLIT_SH
    Hope this helps
    Cheers!
    Samanjay

  • Could you please give me the method to draw Line Graph in detail?

    Could you please give me the method to draw Line Graph in detail?

    Hi,
    First update your username instead of using that number.
    and also provide full information like
    Apex version
    Database version
    I am giving you one link related to charts,
    http://dgielis.blogspot.in/2011/02/apex-4-bug-series-type-bar-line-marker.html
    Hope this will helps you
    Thanks and Regards
    Jitendra

  • I have installed 2010 microsoft office 2010 home and business version for my laptop,and i have installed lync 2013.Now i want create online lync meeting from outlook,but i am unable view that lync icon in outlook.Please give me the solution for this que

    I have installed 2010 Microsoft office 2010 home and business version for my laptop,and I have installed lync 2013.Now i want create online lync meeting from outlook,but i am unable view that lync icon in outlook.Please give me the solution for this issue.
    Regards
    Raghavendar

    Hi Raghavendar,
    Generally, when you install Lync 2013 in the computer with Office 2010, a Lync Meeting Add-in will be installed and enabled in Outlook 2010. Please follow these steps to check it:
    1. In Outlook, click the File tab, click Options, and then click
    Add-Ins.
    2. Please take one of the following actions:
    If the add-in is in the Inactive Application Add-ins list, follow these steps:
    a. In the Manage drop-down list at the bottom of the dialog box, click
    COM Add-ins, and then click Go.
    b. Click to select the check box next to the add-in, and then click OK.
    The New Online Meeting button should now be available in
    Calendar View, and the Online Meeting button should be available when you create a new calendar item.
    If the add-in is in the Disabled Application add-ins list, follow these steps:
    a. In the Manage drop-down list at the bottom of the dialog box, click
    Disabled Items, and then click Go.
    b. Select the add-in, and then click Enable.
    c. Restart Outlook, and then verify that the add-in is displayed in the
    Add-ins dialog box.
    The New Online Meeting button should now be available in
    Calendar View, and the Online Meeting button should now be available when you create a new calendar item.
    3. In Event Viewer, view the Application log to see whether an error was logged for Outlook, for Lync 2013, the Lync Meeting Add-in for Microsoft Office 2013.
    Thanks,
    Winnie Liang
    TechNet Community Support

  • TS1702 i am using iphone 2G, i have updated IOS 3.1.3, but i am not able to use whatsapp. the newer version of whatsapp is not working in my phone. please give me the solution.

    i am using iphone 2G, i have updated IOS 3.1.3, but i am not able to use whatsapp. the newer version of whatsapp is not working in my phone. please give me the solution.

    As newer iPhones and iOS versions are made, apps start to drop support for the older versions of the iOS. It looks like you have fallen victim to this. I commend you for sticking with the original iPhone until now, but it looks like it's time for an upgrade if you want to use apps that have dropped support.
    Also the new iPhone provides hundreds of new features and spec upgrades from the original. Check it out! http://www.apple.com/iphone/

  • How to register a new responsibility in apps through backend. please give me the full details about it

    how to register a new responsibility in apps through backend. please give me the full details about it

    Hi,
    From backend you can add a responsibility to a user using FND_USER_PKG package, and there are so many hit in the google. Let me point out 1:
    http://manoharbabuapps.blogspot.com/2013/08/how-to-add-responsibility-from-back-end.html
    I personally dont know of any API where you can create a responsibility from backend, but from front end you can create. Steps detailed in following link:
    Oracle Applications: creating responsibility in oracle apps R12
    Thanks &
    Best Regards,
    Asif

  • HT1937 is cdmasim work in iphone 5 model-no-A1429 please give me the answer  ?

    is cdmasim work in iphone 5 model- no-A1429 please give me the answer ?  i am in india

    No. A CDMA iPhone can only be used on the CDMA carrier it was originally sold for. IF the GSM side is unlocked, as in the case of the Verizon iPhone 5, it can be used on any compatible GSM carrier. It can not be used on a different CDMA carrier.

  • Keys fn fn (or other) does not activate the dictation only functions "Edit" "Start Dictation .... on MacBook Pro, Please give me the solution Thanks.

    keys fn fn (or other) does not activate the dictation only functions "Edit" "Start Dictation .... on MacBook Pro, Please give me the solution
    Thanks

    Welcome to Apple Support Communities
    It's possible that Dictation is set up to be turned on with a different key. Open System Preferences > Dictation & Speech, and choose the key you want to use to activate Dictation next to "Shortcut". Read > http://support.apple.com/kb/ht5449

  • I want to install an mail Id on Ipad Mini other than yahoo an google but it is showing an error message about SSL could not connect. Please give me the solution on this.

    Hi
    i want to install an mail Id on Ipad Mini other than yahoo an google but it is showing an error message about SSL could not connect. Please give me the solution on this.

    Hello there ypda75,
    I have an article here that has a list of settings to get from your Email provider so you can make sure that the settings are correct. It has troubleshooting steps to try as well. Also I would recommend restarting the router, and/or testing a differnet network.
    iOS: Unable to send or receive email
    http://support.apple.com/kb/ts3899.
    If you are unable to send or receive email, try the following steps:
    Restart the iOS device.
    Tap Safari and attempt to load a webpage to ensure that the device has Internet access. If you're unable to load a webpage, try the Wi-Fi assistant.
    Try an alternative Internet connection.
    If your email is provided by your Internet provider, try connecting from the home network.
    If your iOS device has an active cellular data plan, try to disable Wi-Fi:  Tap Settings > Wi-Fi and turn off Wi-Fi.
    If not, try a different Wi-Fi network.
    Log in to your email provider's website to ensure that the account is active and the password is correct.
    Delete the account from Settings > Mail, Contacts, Calendars and then add the email account again on the iOS device.
    If you're still unable to send or receive email, contact your email provider and verify the account settings are correct. You will need to gather this information (PDF).
    All the very best,
    Sterling

  • Hi ,This is Pratap,please give me the suitable answer

    In ALV report,after filling the selection screen,if we save the selection screen,it will ask the varient name,after giving the varient name and description,we save it,where it is actually stored.
    Please give me the answer.
    In advance Thank's for your responce.
    Pratap.

    Check the tables
    TVARVC Table of Variant Variables (Client-Specific)
    TVARV   Table of variables in selection criteria
    VARIDESC Selection Variants: Description
    Edited by: Mahalakshmi Padmanaban on Feb 29, 2008 5:27 AM

  • I couldn't buy app from my credit card...please give me the solution, I couldn't buy app from my credit card...please give me the solution

    I couldn't buy app from my credit card...please give me the solution, I couldn't buy app from my credit card...please give me the solution

    Accepted forms of payment  >  http://support.apple.com/kb/HT5552
    Changing Account Information  >  http://support.apple.com/kb/HT1918
    Jinnah1951 wrote:
    I couldn't buy app from my credit card..
    If necessary... Contact iTunes Customer Service and request assistance
    Use this Link  >  Apple  Support  iTunes Store  Contact

  • How to do implement the FrameAccess.java code in my project

    Iam doing an project in java for inserting the videos into oracle9i and searching the inserted videos using the frames of the videos inserted.I have done the project to insert and search the videos.But i have been asked to put an EXTRACT button to extract all the frames of the video being inserted.Please help me to implement the FrameAccess.java coding in my existing coding.I have pasted my coding(VideoInsert.java) and FrameAccess.java(used to extract frames) coding.
    The VideoInsert.java when executed will contain browse button to choose the video file(only .mpg files) to be inserted into the database.After selecting the file and when we press open button in the Open dialog box,the video will be played in jmf player in a separate window and the filepath of the video will be included in the textbox.Now what i need is,an extract button should be placed and when it is clicked,the frames of the corresponding selected video has to be extracted in the location where the project files are stored i.e.,the FrameAccess.java coding has to be executed.
    Please help me if anyone knows how to implement the above concept.
    VideoInsert.java
    import javax.swing.*;
    import java.util.*;
    import java.io.*;
    import oracle.sql.*;
    import java.sql.*;
    import oracle.jdbc.driver.*;
    import oracle.sql.BLOB ;
    import symantec.itools.multimedia.ImageViewer;
    public class VideoInsert extends javax.swing.JFrame {
        private Connection con;
        private Statement st=null;
        private OracleResultSet rs=null;
        int count=0;
        int count1=0;
        ImageViewer displaywindow = new ImageViewer();
        /** Creates new form VideoInsert */
        public VideoInsert() {
            initComponents();
            imgpane.add(displaywindow);
            try {
                DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
                con = DriverManager.getConnection("jdbc:oracle:oci:@","scott","tiger");
                  //con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:FIRST","scott","tiger");
                con.setAutoCommit(false);
                st =con.createStatement();
                rs=(OracleResultSet)st.executeQuery("select max(vid) from browsevideo");
                while (rs.next()) {
                    count = (rs.getInt(1) + 1);
                rs.close();
                st =con.createStatement();
                rs=(OracleResultSet)st.executeQuery("select max(imageno) from browseimage");
                while (rs.next()) {
                    count1 = (rs.getInt(1) + 1);
                rs.close();
            } catch (SQLException e) {
                e.printStackTrace();
            txtvid.setText(String.valueOf(count));
             VideoTypeComboBox.addItem("All");
            VideoTypeComboBox.addItem("Entertainment");
            VideoTypeComboBox.addItem("Sports");
            VideoTypeComboBox.addItem("Animation");
            VideoTypeComboBox.addItem("News");
             VideoTypeComboBox.addItem("Others");
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        private void initComponents() {//GEN-BEGIN:initComponents
            jLabel1 = new javax.swing.JLabel();
            txtvid = new javax.swing.JTextField();
            jLabel2 = new javax.swing.JLabel();
            txtvidfile = new javax.swing.JTextField();
            jLabel3 = new javax.swing.JLabel();
            txtvidinfo = new javax.swing.JTextField();
            jLabel4 = new javax.swing.JLabel();
            txtimgfile = new javax.swing.JTextField();
            vidbrowse = new javax.swing.JButton();
            imgbrowse = new javax.swing.JButton();
            jLabel5 = new javax.swing.JLabel();
            txtimgcont = new javax.swing.JTextField();
            insert = new javax.swing.JButton();
            imgpane = new javax.swing.JPanel();
            jLabel6 = new javax.swing.JLabel();
            VideoTypeComboBox = new javax.swing.JComboBox();
            getContentPane().setLayout(null);
            setTitle("VideoInsert");
            addWindowListener(new java.awt.event.WindowAdapter() {
                public void windowClosing(java.awt.event.WindowEvent evt) {
                    exitForm(evt);
            jLabel1.setText("Video ID");
            getContentPane().add(jLabel1);
            jLabel1.setBounds(30, 80, 90, 16);
            txtvid.setEditable(false);
            getContentPane().add(txtvid);
            txtvid.setBounds(130, 80, 130, 20);
            jLabel2.setText("VideoFile");
            getContentPane().add(jLabel2);
            jLabel2.setBounds(30, 130, 70, 16);
            getContentPane().add(txtvidfile);
            txtvidfile.setBounds(130, 130, 130, 20);
            jLabel3.setText("VideoInfo");
            getContentPane().add(jLabel3);
            jLabel3.setBounds(30, 180, 80, 16);
            getContentPane().add(txtvidinfo);
            txtvidinfo.setBounds(130, 180, 130, 20);
            jLabel4.setText("TopImage");
            getContentPane().add(jLabel4);
            jLabel4.setBounds(30, 230, 70, 16);
            getContentPane().add(txtimgfile);
            txtimgfile.setBounds(130, 230, 130, 20);
            vidbrowse.setText("Browse");
            vidbrowse.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    vidbrowseActionPerformed(evt);
            getContentPane().add(vidbrowse);
            vidbrowse.setBounds(280, 130, 78, 26);
            imgbrowse.setText("Browse");
            imgbrowse.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    imgbrowseActionPerformed(evt);
            getContentPane().add(imgbrowse);
            imgbrowse.setBounds(280, 230, 78, 26);
            jLabel5.setText("ImageContent");
            getContentPane().add(jLabel5);
            jLabel5.setBounds(30, 280, 80, 16);
            getContentPane().add(txtimgcont);
            txtimgcont.setBounds(130, 280, 130, 20);
            insert.setText("Insert");
            insert.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    insertActionPerformed(evt);
            getContentPane().add(insert);
            insert.setBounds(150, 400, 81, 26);
            imgpane.setLayout(new java.awt.BorderLayout());
            getContentPane().add(imgpane);
            imgpane.setBounds(410, 120, 350, 260);
            jLabel6.setText("Video Type");
            getContentPane().add(jLabel6);
            jLabel6.setBounds(30, 340, 80, 16);
            getContentPane().add(VideoTypeComboBox);
            VideoTypeComboBox.setBounds(130, 340, 130, 25);
            pack();
            java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
            setSize(new java.awt.Dimension(800, 600));
            setLocation((screenSize.width-800)/2,(screenSize.height-600)/2);
        }//GEN-END:initComponents
        private void insertActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_insertActionPerformed
            BLOB blb= null;
            PreparedStatement stmt = null;
            OutputStream fout=null;
            File f=null;
            FileInputStream fin=null;
            int bufferSize;
            byte[] buffer=null;
            int bytesRead = -1;
            String sfile1 = txtvidfile.getText();
            String sfile2 = txtimgfile.getText();
            String format=null;
            String format1=null;
            String videoinfo=txtvidinfo.getText();
            String imgcontent=txtimgcont.getText();
            String videoType=(String)VideoTypeComboBox.getSelectedItem();
            if(sfile1.endsWith("avi")) {
                format="avi";
            }else if(sfile1.endsWith("mpg")) {
                format="mpg";
            }else {
                format="mpg";
            if(sfile2.endsWith("jpg")) {
                format1="jpg";
            }else if(sfile2.endsWith("gif")) {
                format1="gif";
            }else {
                format1="jpg";
            if((sfile1.length()>0) && (sfile2.length()>0)) {
                try {
                    stmt=con.prepareStatement(" insert into browsevideo values (?,EMPTY_BLOB(),?,?,?)");
                    stmt.setInt(1,count);
                    stmt.setString(2,format);
                    stmt.setString(3,videoinfo);
                     stmt.setString(4,videoType);
                    stmt.executeUpdate();
                    stmt.close();
                    con.commit();
                }catch(Exception e) {
                    e.printStackTrace();
                try {
                    stmt = con.prepareStatement("Select video FROM browsevideo WHERE vid = ? for update of video");
                    stmt.setInt(1,count);
                    rs = (OracleResultSet)stmt.executeQuery();
                    rs.next();
                    blb = rs.getBLOB("video");
                    fout = blb.getBinaryOutputStream();
                    f = new File(sfile1);
                    fin = new FileInputStream(f);
                    bufferSize = blb.getBufferSize();
                    buffer = new byte[bufferSize];
                    while((bytesRead = fin.read(buffer)) != -1) {
                        fout.write(buffer, 0, bytesRead);
                    fout.flush();
                    fout.close();
                    con.commit();
                    rs.close();
                    stmt.close();
                }catch(Exception e) {
                    e.printStackTrace();
                try {
                    stmt=con.prepareStatement(" insert into browseimage values (?,?,?,EMPTY_BLOB(),?,?,?)");
                    stmt.setInt(1,count);
                    stmt.setInt(2,count1);
                    stmt.setInt(3,count1);
                    stmt.setString(4,imgcontent);
                    stmt.setString(5,format1);
                    stmt.setString(6,videoType);
                    stmt.executeUpdate();
                    stmt.close();
                    con.commit();
                }catch(Exception e) {
                    e.printStackTrace();
                try {
                    stmt = con.prepareStatement("Select image FROM browseimage WHERE imageno = ? for update of image");
                    stmt.setInt(1,count1);
                    rs = (OracleResultSet)stmt.executeQuery();
                    if(rs.next()) {
                        blb = rs.getBLOB("image");
                        fout = blb.getBinaryOutputStream();
                        f = new File(sfile2);
                        fin = new FileInputStream(f);
                        bufferSize = blb.getBufferSize();
                        buffer = new byte[bufferSize];
                        while((bytesRead = fin.read(buffer)) != -1) {
                            fout.write(buffer, 0, bytesRead);
                        fout.flush();
                        fout.close();
                        con.commit();
                        rs.close();
                    stmt.close();
                    count++;
                    count1++;
                    txtimgfile.setText("");
                    txtvidfile.setText("");
                    txtimgcont.setText("");
                    txtvidinfo.setText("");
                    txtvid.setText(String.valueOf(count));
                    JOptionPane.showMessageDialog(this,"Successfuly Completed");
                }catch(Exception e) {
                    e.printStackTrace();
        }//GEN-LAST:event_insertActionPerformed
        private void imgbrowseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_imgbrowseActionPerformed
            ExampleFileFilter filter1 = new ExampleFileFilter();
            JFileChooser chooser = new JFileChooser();
            filter1.addExtension("jpg");
            filter1.addExtension("gif");
            filter1.setDescription("JPG,GIF Images");
            chooser.setFileFilter(filter1);
            int returnVal = chooser.showOpenDialog(this);
            if(returnVal == JFileChooser.APPROVE_OPTION) {
                txtimgfile.setText(chooser.getSelectedFile().getAbsolutePath());
                try{
                        displaywindow.setImageURL(new java.net.URL("file:"+txtimgfile.getText()));
                        displaywindow.setStyle(ImageViewer.IMAGE_SCALED_TO_FIT);
                    }catch(Exception e){
                        e.printStackTrace();
        }//GEN-LAST:event_imgbrowseActionPerformed
        private void vidbrowseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_vidbrowseActionPerformed
           ExampleFileFilter filter2 = new ExampleFileFilter();
           JFileChooser chooser = new JFileChooser();
           filter2.addExtension("avi");
            filter2.addExtension("mpg");
            filter2.setDescription("AVI & MPG Video");
            chooser.setFileFilter(filter2);
            int returnVal = chooser.showOpenDialog(this);
            if(returnVal == JFileChooser.APPROVE_OPTION) {
                txtvidfile.setText(chooser.getSelectedFile().getAbsolutePath());
                VideoAudioPlayer vap=new VideoAudioPlayer(txtvidfile.getText());
        }//GEN-LAST:event_vidbrowseActionPerformed
        /** Exit the Application */
        private void exitForm(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_exitForm
            setVisible(false);
            dispose();
        }//GEN-LAST:event_exitForm
         * @param args the command line arguments
        /*public static void main(String args[]) {
            new VideoInsert().show();
        // Variables declaration - do not modify//GEN-BEGIN:variables
        private javax.swing.JButton imgbrowse;
        private javax.swing.JLabel jLabel4;
        private javax.swing.JTextField txtvid;
        private javax.swing.JLabel jLabel1;
        private javax.swing.JTextField txtimgcont;
        private javax.swing.JLabel jLabel3;
        private javax.swing.JLabel jLabel2;
        private javax.swing.JPanel imgpane;
        private javax.swing.JButton insert;
        private javax.swing.JComboBox VideoTypeComboBox;
        private javax.swing.JButton vidbrowse;
        private javax.swing.JTextField txtvidfile;
        private javax.swing.JLabel jLabel6;
        private javax.swing.JLabel jLabel5;
        private javax.swing.JTextField txtimgfile;
        private javax.swing.JTextField txtvidinfo;
        // End of variables declaration//GEN-END:variables
    FrameAccess.java
    import java.awt.*;
    import javax.media.*;
    import javax.media.control.TrackControl;
    import javax.media.Format;
    import javax.media.format.*;
    import java.io.*;
    import javax.imageio.*;
    import javax.imageio.stream.*;
    import java.awt.image.*;
    import java.util.*;
    import javax.media.util.*;
    * Sample program to access individual video frames by using a
    * "pass-thru" codec. The codec is inserted into the data flow
    * path. As data pass through this codec, a callback is invoked
    * for each frame of video data.
    public class FrameAccess implements ControllerListener {
         Processor p;
         Object waitSync = new Object();
         boolean stateTransitionOK = true;
         public boolean alreadyPrnt = false;
         * Given a media locator, create a processor and use that processor
         * as a player to playback the media.
         * During the processor's Configured state, two "pass-thru" codecs,
         * PreAccessCodec and PostAccessCodec, are set on the video track.
         * These codecs are used to get access to individual video frames
         * of the media.
         * Much of the code is just standard code to present media in JMF.
         public boolean open(MediaLocator ml) {
              try {
                   p = Manager.createProcessor(ml);
                                } catch (Exception e) {
                   System.err.println(
                        "Failed to create a processor from the given url: " + e);
                   return false;
              p.addControllerListener(this);
              // Put the Processor into configured state.
              p.configure();
              if (!waitForState(Processor.Configured)) {
                   System.err.println("Failed to configure the processor.");
                   return false;
              // So I can use it as a player.
              p.setContentDescriptor(null);
              // Obtain the track controls.
              TrackControl tc[] = p.getTrackControls();
              if (tc == null) {
                   System.err.println(
                        "Failed to obtain track controls from the processor.");
                   return false;
              // Search for the track control for the video track.
              TrackControl videoTrack = null;
              for (int i = 0; i < tc.length; i++) {
                   if (tc.getFormat() instanceof VideoFormat) videoTrack = tc[i];
                   else     tc[i].setEnabled(false);
              if (videoTrack == null) {
                   System.err.println("The input media does not contain a video track.");
                   return false;
              String videoFormat = videoTrack.getFormat().toString();
              Dimension videoSize = parseVideoSize(videoFormat);
              System.err.println("Video format: " + videoFormat);
              // Instantiate and set the frame access codec to the data flow path.
              try {
                   Codec codec[] = { new PostAccessCodec(videoSize)};
                   videoTrack.setCodecChain(codec);
              } catch (UnsupportedPlugInException e) {
                   System.err.println("The process does not support effects.");
              // Realize the processor.
              p.prefetch();
              if (!waitForState(Processor.Prefetched)) {
                   System.err.println("Failed to realise the processor.");
                   return false;
              p.start();
              return true;
         /**parse the size of the video from the string videoformat*/
         public Dimension parseVideoSize(String videoSize){
              int x=300, y=200;
              StringTokenizer strtok = new StringTokenizer(videoSize, ", ");
              strtok.nextToken();
              String size = strtok.nextToken();
              StringTokenizer sizeStrtok = new StringTokenizer(size, "x");
              try{
                   x = Integer.parseInt(sizeStrtok.nextToken());
                   y = Integer.parseInt(sizeStrtok.nextToken());
              } catch (NumberFormatException e){
                   System.out.println("unable to find video size, assuming default of 300x200");
              System.out.println("Image width = " + String.valueOf(x) +"\nImage height = "+ String.valueOf(y));
              return new Dimension(x, y);
         * Block until the processor has transitioned to the given state.
         * Return false if the transition failed.
         boolean waitForState(int state) {
              synchronized (waitSync) {
                   try {
                        while (p.getState() != state && stateTransitionOK)
                             waitSync.wait();
                   } catch (Exception e) {
              return stateTransitionOK;
         * Controller Listener.
         public void controllerUpdate(ControllerEvent evt) {
              if (evt instanceof ConfigureCompleteEvent
                   || evt instanceof RealizeCompleteEvent
                   || evt instanceof PrefetchCompleteEvent) {
                   synchronized (waitSync) {
                        stateTransitionOK = true;
                        waitSync.notifyAll();
              } else if (evt instanceof ResourceUnavailableEvent) {
                   synchronized (waitSync) {
                        stateTransitionOK = false;
                        waitSync.notifyAll();
              } else if (evt instanceof EndOfMediaEvent) {
                   p.close();
                   System.exit(0);
         * Main program
         public static void main(String[] args) {
    //          if (args.length == 0) {
    //               prUsage();
    //               System.exit(0);
    // System.out.print("masoud");
    String url = new String("file:F:\\AVSEQ01.mpg");
              if (url.indexOf(":") < 0) {
                   prUsage();
                   System.exit(0);
              MediaLocator ml;
              if ((ml = new MediaLocator(url)) == null) {
                   System.err.println("Cannot build media locator from: " + url);
                   System.exit(0);
              FrameAccess fa = new FrameAccess();
              if (!fa.open(ml))
                   System.exit(0);
         static void prUsage() {
              System.err.println("Usage: java FrameAccess <url>");
         * Inner class.
         * A pass-through codec to access to individual frames.
         public class PreAccessCodec implements Codec {
              * Callback to access individual video frames.
              void accessFrame(Buffer frame) {
                   // For demo, we'll just print out the frame #, time &
                   // data length.
                   long t = (long) (frame.getTimeStamp() / 10000000f);
                   System.err.println(
                        "Pre: frame #: "
                             + frame.getSequenceNumber()
                             + ", time: "
                             + ((float) t) / 100f
                             + ", len: "
                             + frame.getLength());
              * The code for a pass through codec.
              // We'll advertize as supporting all video formats.
              protected Format supportedIns[] = new Format[] { new VideoFormat(null)};
              // We'll advertize as supporting all video formats.
              protected Format supportedOuts[] = new Format[] { new VideoFormat(null)};
              Format input = null, output = null;
              public String getName() {
                   return "Pre-Access Codec";
              //these dont do anything
              public void open() {}
              public void close() {}
              public void reset() {}
              public Format[] getSupportedInputFormats() {
                   return supportedIns;
              public Format[] getSupportedOutputFormats(Format in) {
                   if (in == null)
                        return supportedOuts;
                   else {
                        // If an input format is given, we use that input format
                        // as the output since we are not modifying the bit stream
                        // at all.
                        Format outs[] = new Format[1];
                        outs[0] = in;
                        return outs;
              public Format setInputFormat(Format format) {
                   input = format;
                   return input;
              public Format setOutputFormat(Format format) {
                   output = format;
                   return output;
              public int process(Buffer in, Buffer out) {
                   // This is the "Callback" to access individual frames.
                   accessFrame(in);
                   // Swap the data between the input & output.
                   Object data = in.getData();
                   in.setData(out.getData());
                   out.setData(data);
                   // Copy the input attributes to the output
                   out.setFlags(Buffer.FLAG_NO_SYNC);
                   out.setFormat(in.getFormat());
                   out.setLength(in.getLength());
                   out.setOffset(in.getOffset());
                   return BUFFER_PROCESSED_OK;
              public Object[] getControls() {
                   return new Object[0];
              public Object getControl(String type) {
                   return null;
         public class PostAccessCodec extends PreAccessCodec {
              // We'll advertize as supporting all video formats.
              public PostAccessCodec(Dimension size) {
                   supportedIns = new Format[] { new RGBFormat()};
                   this.size = size;
              * Callback to access individual video frames.
              void accessFrame(Buffer frame) {
                   // For demo, we'll just print out the frame #, time &
                   // data length.
                   if (!alreadyPrnt) {
                        BufferToImage stopBuffer = new BufferToImage((VideoFormat) frame.getFormat());
                        Image stopImage = stopBuffer.createImage(frame);
                        try {
                             BufferedImage outImage = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_RGB);
                             Graphics og = outImage.getGraphics();
                             og.drawImage(stopImage, 0, 0, size.width, size.height, null);
                             //prepareImage(outImage,rheight,rheight, null);
                             Iterator writers = ImageIO.getImageWritersByFormatName("jpg");
                             ImageWriter writer = (ImageWriter) writers.next();
                             //Once an ImageWriter has been obtained, its destination must be set to an ImageOutputStream:
                             File f = new File(frame.getSequenceNumber() + ".jpg");
                             ImageOutputStream ios = ImageIO.createImageOutputStream(f);
                             writer.setOutput(ios);
                             //Finally, the image may be written to the output stream:
                             //BufferedImage bi;
                             //writer.write(imagebi);
                             writer.write(outImage);
                             ios.close();
                        } catch (IOException e) {
                             System.out.println("Error :" + e);
                   //alreadyPrnt = true;
                   long t = (long) (frame.getTimeStamp() / 10000000f);
                   System.err.println(
                        "Post: frame #: "
                             + frame.getSequenceNumber()
                             + ", time: "
                             + ((float) t) / 100f
                             + ", len: "
                             + frame.getLength());
              public String getName() {
                   return "Post-Access Codec";
              private Dimension size;

    check out the java.lang.Runtime and java.lang.Process classes

  • How to get personnel number of the user in the wd java code in Leave reques

    Hi all,
    we are using the standard Leave Request Applicatin ESS.
    can any one please tell me how to get the personnel number of the user in the WD java code?
    cause i have pass the pernr number to a bapi and get the details.
    please help me its urgent.
    thanks in advance.

    Hi Madhu,
    Create a model for the particular bapi in wd java and acess it in your component. Then pernr parameter will be available in the context and u can pass value for the parameter (pernr) to the model and get the output.
    If you hav any doubt, please let me know.
    Regards,
    Jithin

Maybe you are looking for

  • Reg: DS enhancement

    hi experts, am creating a bex query ..which contains of PR CREATOR , SERVICE ENTRY SHEET CREATOR, PO CREATOR..but in my bw target i can see 0created by field only. Our MM team has given EBAN-ERNAM FOR PR creator , EKKO-ERNAM FOR PO CREATOR and ESSE-E

  • How to handle the OK button of the parameters prompt of a crystal report

    Hi, how to handle the OK button of the parameters prompt of a crystal report in vba.NET? I want to use the parameter prompt from the crystal report itself and I want to know when the report is ready. I need to export programatically by sending email

  • Acrobat Toolbar in Lotus Notes 8.5

    Does anyone know how i can get the acrobat toolbar to show up in Lotus Notes 8.5. I know this has been an issue in the past and I have already tried the steps of manually adding the add-ons into the configuration files for Notes but that doesn't seem

  • HD 1280 x 720 , Skips Frames with Quicktime 7.*

    Quicktime skips frames when I'm trying to play a video I created with my Digital camera.(Kodak Z1275) Its not the camera because it plays flawlessly on screen. I upload the file to the computer and Quicktime skips a few seconds throughout the entire

  • Order related Billing : Performance enhancement

    Hi Billing experts, We use order related standard CRM Billing (Periodic) and we have the below scenario. 100 Customer share 1000 contracts with 0.5 Million Sales orders, undergo billing every month. currently it is taking 30 hours to finish the billi