System Call in Classes - CL_IXML

Hi Gurus,
Please interpret this code.
system-call ixml did 259129538 parameters cl_ixml=>the_ixml me rval.
Regards,
G.Srinivasan.

Hi,
system calls are used by SAP to call specific functionality of the SAP kernel... in this case, a system call is made using some parameters, including an attribute of class CL_IXML.
You can get some info on the general principle by checking the command system-call in the online help.
Note that system calls are for internal SAP implementation and use only, and should not be replicated in a customer program, since their interfaces or behaviours are not (publicly) documented and are subject to change without further notice.
Regards,
Trond
Edited by: Trond Stroemme on Nov 21, 2008 9:20 AM

Similar Messages

  • Calling a class's method from another class

    Hi, i would like to know if it's possible to call a Class's method and get it's return from another Class. This first Class doesn't extend the second. I've got a Choice on this first class and depending on what is selected, i want to draw a image on the second class witch is a Panel extended. I put the control "if" on the paint() method of the second class witch is called from the first by the repaint() (first_class.repaint()) on itemStateChanged(). Thankx 4 your help. I'm stuck with this.This program is for my postgraduation final project and i'm very late....

    import java.awt.*;
    import java.sql.*;
    * This type was generated by a SmartGuide.
    class Test extends Frame {
         private java.awt.Panel ivjComboPane = null;
         private java.awt.Panel ivjContentsPane = null;
         IvjEventHandler ivjEventHandler = new IvjEventHandler();
         private Combobox ivjCombobox1 = null;
    class IvjEventHandler implements java.awt.event.WindowListener {
              public void windowActivated(java.awt.event.WindowEvent e) {};
              public void windowClosed(java.awt.event.WindowEvent e) {};
              public void windowClosing(java.awt.event.WindowEvent e) {
                   if (e.getSource() == Test.this)
                        connEtoC1(e);
              public void windowDeactivated(java.awt.event.WindowEvent e) {};
              public void windowDeiconified(java.awt.event.WindowEvent e) {};
              public void windowIconified(java.awt.event.WindowEvent e) {};
              public void windowOpened(java.awt.event.WindowEvent e) {};
         private Panel ivjPanel1 = null;
    * Combo constructor comment.
    public Test() {
         super();
         initialize();
    * Combo constructor comment.
    * @param title java.lang.String
    public Test(String title) {
         super(title);
    * Insert the method's description here.
    * Creation date: (11/16/2001 7:48:51 PM)
    * @param s java.lang.String
    public void conexao(String s) {
         try {
              Class.forName("oracle.jdbc.driver.OracleDriver");
              String url = "jdbc:oracle:thin:system/[email protected]:1521:puc";
              Connection db = DriverManager.getConnection(url);
              //String sql_str = "SELECT * FROM referencia";
              Statement sq_stmt = db.createStatement();
              ResultSet rs = sq_stmt.executeQuery(s);
              ivjCombobox1.addItem("");
              while (rs.next()) {
                   String dt = rs.getString(1);
                   ivjCombobox1.addItem(dt);
              db.close();
         } catch (SQLException e) {
              System.out.println("Erro sql" + e);
         } catch (ClassNotFoundException cnf) {
    * connEtoC1: (Combo.window.windowClosing(java.awt.event.WindowEvent) --> Combo.dispose()V)
    * @param arg1 java.awt.event.WindowEvent
    /* WARNING: THIS METHOD WILL BE REGENERATED. */
    private void connEtoC1(java.awt.event.WindowEvent arg1) {
         try {
              // user code begin {1}
              // user code end
              this.dispose();
              // user code begin {2}
              // user code end
         } catch (java.lang.Throwable ivjExc) {
              // user code begin {3}
              // user code end
              handleException(ivjExc);
    * Return the Combobox1 property value.
    * @return Combobox
    /* WARNING: THIS METHOD WILL BE REGENERATED. */
    private Combobox getCombobox1() {
         if (ivjCombobox1 == null) {
              try {
                   ivjCombobox1 = new Combobox();
                   ivjCombobox1.setName("Combobox1");
                   ivjCombobox1.setLocation(30, 30);
                   // user code begin {1}
                   this.conexao("select * from referencia");
                   // user code end
              } catch (java.lang.Throwable ivjExc) {
                   // user code begin {2}
                   // user code end
                   handleException(ivjExc);
         return ivjCombobox1;
    * Return the ComboPane property value.
    * @return java.awt.Panel
    /* WARNING: THIS METHOD WILL BE REGENERATED. */
    private java.awt.Panel getComboPane() {
         if (ivjComboPane == null) {
              try {
                   ivjComboPane = new java.awt.Panel();
                   ivjComboPane.setName("ComboPane");
                   ivjComboPane.setLayout(null);
                   getComboPane().add(getCombobox1(), getCombobox1().getName());
                   getComboPane().add(getPanel1(), getPanel1().getName());
                   // user code begin {1}
                   // user code end
              } catch (java.lang.Throwable ivjExc) {
                   // user code begin {2}
                   // user code end
                   handleException(ivjExc);
         return ivjComboPane;
    * Return the ContentsPane property value.
    * @return java.awt.Panel
    /* WARNING: THIS METHOD WILL BE REGENERATED. */
    private java.awt.Panel getContentsPane() {
         if (ivjContentsPane == null) {
              try {
                   ivjContentsPane = new java.awt.Panel();
                   ivjContentsPane.setName("ContentsPane");
                   ivjContentsPane.setLayout(new java.awt.BorderLayout());
                   getContentsPane().add(getComboPane(), "Center");
                   // user code begin {1}
                   // user code end
              } catch (java.lang.Throwable ivjExc) {
                   // user code begin {2}
                   // user code end
                   handleException(ivjExc);
         return ivjContentsPane;
    * Return the Panel1 property value.
    * @return Panel
    /* WARNING: THIS METHOD WILL BE REGENERATED. */
    private Panel getPanel1() {
         if (ivjPanel1 == null) {
              try {
                   ivjPanel1 = new Panel();
                   ivjPanel1.setName("Panel1");
                   ivjPanel1.setBackground(java.awt.SystemColor.scrollbar);
                   ivjPanel1.setBounds(24, 118, 244, 154);
                   // user code begin {1}
                   // user code end
              } catch (java.lang.Throwable ivjExc) {
                   // user code begin {2}
                   // user code end
                   handleException(ivjExc);
         return ivjPanel1;
    * Called whenever the part throws an exception.
    * @param exception java.lang.Throwable
    private void handleException(java.lang.Throwable exception) {
         /* Uncomment the following lines to print uncaught exceptions to stdout */
         // System.out.println("--------- UNCAUGHT EXCEPTION ---------");
         // exception.printStackTrace(System.out);
    * Initializes connections
    * @exception java.lang.Exception The exception description.
    /* WARNING: THIS METHOD WILL BE REGENERATED. */
    private void initConnections() throws java.lang.Exception {
         // user code begin {1}
         // user code end
         this.addWindowListener(ivjEventHandler);
    * Initialize the class.
    /* WARNING: THIS METHOD WILL BE REGENERATED. */
    private void initialize() {
         try {
              // user code begin {1}
              // user code end
              setName("Combo");
              setLayout(new java.awt.BorderLayout());
              setSize(460, 300);
              setTitle("Combo");
              add(getContentsPane(), "Center");
              initConnections();
         } catch (java.lang.Throwable ivjExc) {
              handleException(ivjExc);
         // user code begin {2}
         // user code end
    * Insert the method's description here.
    * Creation date: (11/17/2001 2:02:58 PM)
    * @return java.lang.String
    public String readCombo() {
         String dado = ivjCombobox1.getSelectedItem();
         return dado;
    * Starts the application.
    * @param args an array of command-line arguments
    public static void main(java.lang.String[] args) {
         try {
              /* Create the frame */
              Test aTest = new Test();
              /* Add a windowListener for the windowClosedEvent */
              aTest.addWindowListener(new java.awt.event.WindowAdapter() {
                   public void windowClosed(java.awt.event.WindowEvent e) {
                        System.exit(0);
              aTest.setVisible(true);
         } catch (Throwable exception) {
              System.err.println("Exception occurred in main() of Test");
              exception.printStackTrace(System.out);
    * Insert the type's description here.
    * Creation date: (11/17/2001 1:59:15 PM)
    * @author:
    class Combobox extends java.awt.Choice {
         public java.lang.String dado;
    * Combobox constructor comment.
    public Combobox() {
         super();
         initialize();
    * Called whenever the part throws an exception.
    * @param exception java.lang.Throwable
    private void handleException(java.lang.Throwable exception) {
         /* Uncomment the following lines to print uncaught exceptions to stdout */
         // System.out.println("--------- UNCAUGHT EXCEPTION ---------");
         // exception.printStackTrace(System.out);
    * Initialize the class.
    /* WARNING: THIS METHOD WILL BE REGENERATED. */
    private void initialize() {
         try {
              // user code begin {1}
              // user code end
              setName("Combobox");
              setSize(133, 23);
         } catch (java.lang.Throwable ivjExc) {
              handleException(ivjExc);
         // user code begin {2}
         // user code end
    * main entrypoint - starts the part when it is run as an application
    * @param args java.lang.String[]
    public static void main(java.lang.String[] args) {
         try {
              java.awt.Frame frame = new java.awt.Frame();
              Combobox aCombobox;
              aCombobox = new Combobox();
              frame.add("Center", aCombobox);
              frame.setSize(aCombobox.getSize());
              frame.addWindowListener(new java.awt.event.WindowAdapter() {
                   public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
              frame.setVisible(true);
         } catch (Throwable exception) {
              System.err.println("Exception occurred in main() of Combobox");
              exception.printStackTrace(System.out);
    * Insert the type's description here.
    * Creation date: (11/17/2001 2:16:11 PM)
    * @author:
    class Panel extends java.awt.Panel {
    * Panel constructor comment.
    public Panel() {
         super();
         initialize();
    * Panel constructor comment.
    * @param layout java.awt.LayoutManager
    public Panel(java.awt.LayoutManager layout) {
         super(layout);
    * Called whenever the part throws an exception.
    * @param exception java.lang.Throwable
    private void handleException(java.lang.Throwable exception) {
         /* Uncomment the following lines to print uncaught exceptions to stdout */
         // System.out.println("--------- UNCAUGHT EXCEPTION ---------");
         // exception.printStackTrace(System.out);
    * Initialize the class.
    /* WARNING: THIS METHOD WILL BE REGENERATED. */
    private void initialize() {
         try {
              // user code begin {1}
              // user code end
              setName("Panel");
              setLayout(null);
              setSize(260, 127);
         } catch (java.lang.Throwable ivjExc) {
              handleException(ivjExc);
         // user code begin {2}
         // user code end
    * main entrypoint - starts the part when it is run as an application
    * @param args java.lang.String[]
    public static void main(java.lang.String[] args) {
         try {
              java.awt.Frame frame = new java.awt.Frame();
              Panel aPanel;
              aPanel = new Panel();
              frame.add("Center", aPanel);
              frame.setSize(aPanel.getSize());
              frame.addWindowListener(new java.awt.event.WindowAdapter() {
                   public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
              frame.setVisible(true);
         } catch (Throwable exception) {
              System.err.println("Exception occurred in main() of java.awt.Panel");
              exception.printStackTrace(System.out);
    * Insert the method's description here.
    * Creation date: (11/17/2001 2:18:36 PM)
    public void paint(Graphics g) {
    /* Here's the error:
    C:\Test.java:389: non-static method readCombo() cannot be referenced from a static context
         System.out.println(Test.lerCombo());*/
         System.out.println(Test.readCombo());

  • Making system calls in java

    I want to join some split files into one. In command prompt I use COPY /B file.1+file.2 file to join the files. How can i do the same in my java application. Please show the code which I suppose will use getRuntime. Thanks in advance.

    Well if there is a problem with system calls then can
    you tell me if there is a class in java for
    concetanating files. Not directly.
    At present I am joing the files
    by reading each byte from the files and writing them
    to another file which takes hell lot of time. You should read the files in large chunks. Much much faster.
    Thanks
    in advance again. Also if you say about sequential
    file class then please expalin a bit bcs I couldn't
    implement it.Post the code you are having trouble with explaining what it should do and what it actually does.

  • Reading output of a system call

    Hi,
    It appears that java system call does not return a value in Netware OS.
    The same code functions flawlessly on other OS'es, eg. linux and windows.
    If the following code is run on a Netware (6.5), the following error is
    returned:
    External App Returned:
    java.io.IOException: Bad file number
    Does anyone knows how to receive the values from the system call on Netware?
    To reproduce the problem, do the following:
    1) save the included source code to netware server's sys:java/classes
    with a filename ExecuteExternalApp.java
    2) compile it issuing a console command:
    javac sys:java/classes/ExecuteExternalApp.java
    3) execute the application:
    java ExecuteExternalApp volumes
    This should successfully launch the system command "volumes" but also
    would give an error message:
    External App Returned:
    java.io.IOException: Bad file number
    ---- Source code
    import java.io.*;
    public class ExecuteExternalApp{
    public static String executeSystemCommand(String command) throws
    Exception {
    String ret = "";
    try
    Process process = Runtime.getRuntime().exec(command);
    BufferedReader input = new BufferedReader(new
    InputStreamReader(process.getInputStream()));
    BufferedReader err = new BufferedReader(new
    InputStreamReader(process.getErrorStream()));
    //InputStreamReader iar = new
    InputStreamReader(process.getInputStream());
    StringBuffer sb = new StringBuffer();
    String line = "";
    //while ((line = input.readLine()) != null)
    //testi tuleeko yksi rivi
    line = input.readLine();
    sb.append(line);
    input.close();
    ret = sb.toString();
    catch (Exception err)
    ret = err.toString();
    return ret;
    public static void main(String[] args) throws Exception {
    if (args.length > 0){
    String output = executeSystemCommand(args[0]);
    System.out.println("External App Returned:");
    System.out.println(output);
    else
    System.out.println("Usage: ExecuteExternalApp <command>");

    Guenter wrote:
    > Hi Jonne,
    > Jonne Viljanen <jonne.viljanen@rmv_this.helsinki.fi> wrote in
    > news:y%[email protected]:
    >
    >> Thank you for your effort. I've been trying to write a simple program
    >> that would monitor if any cluster resource would be in comatose and in
    >> such case, it would try to online the resource on some other cluster
    >> node. For this I'd need to run these system commands and parse their
    >> output:
    >>
    >> - "cluster resources" - to see if any resource is in comatose
    >>
    >> and
    >>
    >> - "cluster view" - to determine which nodes are online.
    >>
    >> Also i'd need to run "cluster offline resource" and "cluster online
    >> resource node", but for these command I would not need to get the
    >> output.
    >>
    >> I know that my approach is a bit clumsy, but it's beauty is in its
    >> simplicity. Novell's engineer suggested that with a bit more effort one
    >> could read the data from ldap or cluster related virtual XML files on
    >> the _Admin volume. I think that I should investigate the latter
    >> approach, since I'd like to avoid handling the ldap authentication. I
    >> appreciate any comments and suggestions. Code examples are also greatly
    >> welcomed ;-)
    > hmmm, well that sounds to me as if the language doesnt matter at all since
    > finally you most likely fire your app from cron to do these tasks frequently
    > automatically, right? Therefore I'd suggest you take a look at Perl - it
    > seems better suited for these tasks; look at sys:/perl/scripts where you find
    > Perl scripts which do already some cluster stuff, and AFAICT these make use
    > of the _ADMIN volume.
    > Additional info and Perl samples can be found with the VFS NDK IIRC:
    > http://developer.novell.com/wiki/ind..._File_Services
    >
    > greetz, Gnter.
    >
    Hi Gnter,
    Thank you for your excellent help. I started to play with the _ADMIN
    -volume today. I was amazed to see how much can be done with it. I got
    my little cluster watch application almost working in just 1 hour, but
    then spent the rest of the day trying to get it fully functional ;-) I
    still cannot figure out what is wrong with my code, so I was wondering
    if I could get any help from this newsgroup.
    I'm able to read the *.xml files and determine the cluster state and all
    the information I need. However I dont seem to be able to write the
    command files. I'm trying the following:
    public void offlineClusterResource(String resourceName) {
    String fileName = "_ADMIN:/Novell/cluster/Resource.cmd";
    //String logFile = "sys:java/classes/ClusterWorker.log";
    String commandLine = "<virtualIO><datastream
    name=\"command\"></virtualIO>"+
    "<ncsRequest><offline>" +
    "<resource>" + resourceName + "</resource>" +
    "</offline></ncsRequest>";
    //Log("Turning the cluster resource " + resourceName + "
    offline!!!", logFile);
    try {
    //PrintWriter in autoFlush mode
    PrintWriter pw = new PrintWriter(new FileWriter(fileName,
    false), false);
    pw.println(commandLine);
    pw.close();
    } catch (IOException e) {
    System.out.println("Unable to write " + fileName);
    It seems not to write anything to _ADMIN:/Novell/cluster/Resource.cmd.
    If I set the file to be eg. SYS:/tmp/Resource.cmd -it writes nicely to
    the file.
    What am I missing here?
    Cheers,
    Jonne

  • Calling a class from another one (newbie)

    (cib; 2003-oct28)
    Hi,
    PLugin for JSPWIKI;
    Error when calling a class from a plugin.
    Why is it wrong to call the class :
    public class XercesChecker {
    public static void main(String[] args) {
    by:
    String filepath = (fileList.getPath());
    XercesChecker xc = new XercesChecker(filepath);
    ---COMPILATION ERROR MESSAGE-------*
    javac -classpath"../;E:\prog\Tomcat41\webapps\JSPWiki\WEB-INF\lib\JSPWiki.jar"
    XercesCheckerLoopPlugin.java
    XercesCheckerLoopPlugin.java:40: cannot resolve symbol
    symbol : constructor XercesChecker (java.lang.String)
    location: class vendo.XercesChecker
    XercesChecker xc = new XercesChecker(filepath);
    ^
    1 error
    ---XercesCheckerLoopPlugin.java------*
    package vendo;
    import vendo.XercesChecker;
    import java.io.*;
    import java.io.Writer;
    import java.io.File;
    import com.ecyrd.jspwiki.WikiContext;
    import java.util.Map;
    import com.ecyrd.jspwiki.plugin.WikiPlugin;
    import com.ecyrd.jspwiki.plugin.PluginException;
    public class XercesCheckerLoopPlugin implements WikiPlugin
    StringBuffer output = new StringBuffer();
    public String execute(WikiContext context,
    Map params)
    throws PluginException
    String message="";
    // Get the names of the directory to loop through
    String dirName = (String)params.get( "dir" );
    String monresult="";
    try {
    File dirObj = new File (dirName);
    if (dirObj.exists() == true) {
    if (dirObj.isDirectory() == true) {
    // Create an array of File objects, one for each file or directory in
    dirObj.
    File [] fileList = dirObj.listFiles();
    // Display Source Directory Name.
    output.append("Source Directory: "+dirName);
    // Loop through File array and display.
    for (int i = 0; i < fileList.length; i++) {
    // Print the path to each file.
    String filepath = (fileList[i].getPath());
    output.append ("<br />D�b:" + fileList[i].getPath() + "Fin<br />" );
    XercesChecker xc = new XercesChecker(filepath);
    //output.append (xc(filepath));
    } // for loop
    } else { output.append (dirName+" is not a directory."); }
    } else { output.append ("Directory "+dirName+" does not exist."); }
    monresult = output.toString();
    catch(Exception e){}
    return monresult;
    ----------XercesChecker------------*
    package vendo;
    import org.apache.xerces.parsers.DOMParser;
    import org.xml.sax.SAXException;
    import java.io.IOException;
    //http://www.ibiblio.org/xml/books/xmljava/chapters/ch09s06.html
    public class XercesChecker {
    public static void main(String[] args) {
    if (args.length <= 0) {
    System.out.println("Usage: java XercesChecker URL");
    return;
    String document = args[0];
    DOMParser parser = new DOMParser();
    try {
    parser.parse(document);
    System.out.println(document + " is well-formed.");
    catch (SAXException e) {
    System.out.println(document + " is not well-formed.");
    catch (IOException e) {
    System.out.println(
    "Due to an IOException, the parser could not check "
    + document
    Thanks for any help
    webmaster.cib(at)laposte.net

    I do not see a constructor in the XercesChecker class that accepts a String.

  • Write system call results to a text box

    I am making a DOS system call that creates a file. Once this file is created it gives me a "packet created successfully" message that is written to the screen.
    I am using Netbeans 5.5.1 and Swing. and I want this message to be output into a JtextArea. The system call works fine and the file is created, I just can't get the message to write to my text area.
    Below is a sample of my code:
    private void btn_importActionPerformed(java.awt.event.ActionEvent evt) {                                          
    // TODO add your handling code here:
         String Rep = txt_Repname.getText();
         String Work = txt_Workdir2.getText();
         String VOB = txt_VOBtag.getText();
         String VOBstorage = txt_VOBName2.getText();
         String Replicapath = txt_Replicapath.getText();
         String command = ("cmd /c multitool mkreplica -import -npreserve -nc -vreplica " + Rep + " -work " + Work + " -tag \\" + VOB + " -vob " + VOBstorage + " " + Replicapath);
         StringBuffer sb = new StringBuffer();
         Process p = null;
         try {
                p = Runtime.getRuntime().exec(command);
            } catch (IOException ex) {
                ex.printStackTrace();
        Scanner s = new Scanner(p.getInputStream());
        while(s.hasNextLine()) {
            sb.append(s.nextLine()+"\n");
        String result = sb.toString();
        txt_Importresults.setText(result);
        }           

    This works okay for me.
    import java.io.IOException;
    import java.util.Scanner;
    public class Tester {
         public static void main(String[] args) throws IOException {
               StringBuffer sb = new StringBuffer();
              Process p = null;
              try {
                     p = Runtime.getRuntime().exec("HELP");
                 } catch (IOException ex) {
                     ex.printStackTrace();
             Scanner s = new Scanner(p.getInputStream());
             while(s.hasNextLine()) {
                 sb.append(s.nextLine());
                 sb.append(System.getProperty("line.separator"));
             System.out.println(sb.toString());
    }Have you read the Traps article on JavaWorld?
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

  • System Call from Java, problem LD_LIBRARY_PATH

    I use class Runtime to invoke Operating System Call.
    I want to run OS command gpg (gnu program for encrypting/ decrypting files).
    What is interesting, when I run my sqlplus script from system user (used for database installation) call ends with success.
    Running script from other os users or machines ends with -1 code and error message:
    "ld.so.1: gpg: fatal: libiconv.so.2: open failed: No such file or directory"
    gpg uses libraries given LD_LIBRARY_PATH (/opt/gnupg/lib:/usr/lib:/usr/local/lib)
    I think that is the problem. Is there a workaround for that??
    Best regard
    Grzegorz

    Maybe related to the fact that the PATH environment variable is unset then re-initialized by Oracle to PATH = /usr/local/bin:/bin:/usr/bin. Try using absolute path for the OS commands.
    Kuassi
    - blog http://db360.blogspot.com/
    - book http://db360.blogspot.com/2006/08/oracle-database-programming-using-java_01.html

  • System Call by Java Application - [change path and run of the other progra]

    public class  A {
         public static void main (String[] args)
              System.out.println("Hi");
    }I do have above A.java.
    I am generating A.class from it.
    A.class is in the following directory :
    /home/sachin/work/Sample_Directory/bin/hello_filetest/
    I have another program which makes System call.
    But the problem is B.java is in the different directory :
    /home/sachin/work/Sample_Directory/src/hello_filetest/
    public class  B {
         public static void main (String[] args) {
    Process p1 = Runtime.getRuntime().exec("java A);
                BufferedReader stdInput = new BufferedReader(new
                     InputStreamReader(p1.getInputStream()));
    while ((s = stdInput.readLine()) != null) {
                    System.out.println(s);
    {code}
            So, my question is how to change directory by system calls and execute the program
    which is lying in other directory ????
    Thank you.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    The following code will call javac on a .java file, which will compile it into a .class file
         public static void javacTest() {
              JFileChooser jf = new JFileChooser();
              if (jf.showOpenDialog(null) != jf.APPROVE_OPTION) return;
              File file = jf.getSelectedFile();
              File dir = file.getParentFile();
              try {
                   Process p = Runtime.getRuntime().exec("javac " + file.getName(), null, dir);
                   IOUtils.pipe(p.getInputStream(), System.out);
                   IOUtils.pipe(p.getErrorStream(), System.out);
              catch (IOException iox) {
                   iox.printStackTrace();
         }Is that what you're trying to do, or are you trying to run the compiled (.class) file? Running your .class file should be basically the same as the above, assuming that you are not using any non j2se libraries, except that you need to take into account the package (if package is x.y, you must have file in ...src\x\y\foo.class - call "java x.y.foo" from src)

  • How to deal with pipe in the Java system call?

    Hi, all,
    I tried to use a system call in java. The command contains a "|" pipe. It works both in perl and C if I do {color:#3366ff}system("ls -l | wc"){color}, but when I do it in Java, I didn't get anything returned. Here is the code
    {color:#3366ff}import java.io.*;
    class SystemCall{
    public static void main(String[] args) throws IOException {
    StringBuffer sb = new StringBuffer();
    Process p = Runtime.getRuntime().exec("ls -l | wc");
    BufferedReader br=new BufferedReader(new InputStreamReader(p.getInputStream()));
    String line;
    while((line=br.readLine())!=null) {
    System.out.println(line);
    }{color}
    If I use Runtime.getRuntime().exec("ls -l"), the code returns correctly. Does anyone know the solution?
    Thanks

    When you exec a process, it doesn't go through the shell. The I/O redirection symbols are interpreted and used by the shell.
    You have a few options.
    One is to not use Runtime.exec at all. You really don't need it for what you're doing -- the stuff in java.io is fine for that.
    Another is to exec multiple processes and do the redirection in Java yourself. I wouldn't recommend that, but it's an option.
    Another is to exec a shell, and pass your program to it as a shell script or as a one-line script passed on the command line.
    I'd suggest the first one in this case.
    By the way, what you're doing isn't really a "system call". You're forking and exec'ing a process (or really, multiple processes).

  • One Class Calling Another Class ......Need Help..ugh

    this is the class that calls another class called cuboid
    package WindowsApplication1;
    * Summary description for Cuboid.
    //Import the classes to allow the use of the array, iterator and listiterator
    import java.util.ArrayList;
    import java.util.Iterator;
    import java.util.ListIterator;
    public class DisplayCuboidValues
         public static void main(String args[])
              //Create the array list
              ArrayList VolumeList = new ArrayList();
              //Create the counter to loop 4 times and get 4 different volumes. Modify the counter
              //if you need a different values
              int Counter = 1;
              //Initialize the counter to loop 4 times in order to get the 4 objects
              while (Counter < 5)
                   Cuboid mp = new Cuboid(2, 4, 3);
                   //Add the values to the array
                   VolumeList.add(mp);
                   // get the volume again via accessor method(Optional)
                   //int Volume = mp.Volume();
                   //System.out.println(Volume);
                   //Increment the counter to obtain a new value in the array
                   Counter = Counter + 1;
              // Retrieve iterator to the radiuslist
              Iterator itr1 = VolumeList.iterator();
              while (itr1.hasNext())
              // call Cuboid.toString()
              System.out.print(itr1.next());
              System.out.println();
    }this is the cuboid class
    package WindowsApplication1;
    * Summary description for Cuboid.
    public class Cuboid
         private final int length, width, height;
         //1st contructor with 3 arguments
         public Cuboid(int length, int width, int height)
              this.length = length;
              this.width = width;
              this.height = height;
         //2nd constructor with no arguments
    //I BELIEVE THIS PUBLIC CUBOID IS THE ONE THE PROVOKES THE ERROR. BUT I CAN NOT DELETE IT BECAUSE I NEED ANOTHER PUBLIC CUBOID. SO IDK WHAT TO DO......
         public Cuboid()
              this.length = length;
              this.width = width;
              this.height = height;
            public String toString() {
                   return "This cuboid has length x, width y, height z, and has volume of v where X=" + length + " " + "Y=" + width + " " + "Z=" + height + " " + "Volume=" + length * width * height + ".   --   ";
         //Method to calculate the Volume
         public int Volume()
              return length * width * height;
         }This is what i have done. I have created a project named ths(which i do not use it at all). Then, i created one file called DisplayCuboidValues under ths. Then i created the file Cuboid under ths too. But it gives me errors. like this one:
    init:
    deps-jar:
    Created dir: C:\Documents and Settings\Owner\ths\build\classes
    Compiling 1 source file to C:\Documents and Settings\Owner\ths\build\classes
    C:\Documents and Settings\Owner\ths\src\DisplayCuboidValues\Cuboid.java:25: variable length might not have been initialized
    this.length = length;
    *^*
    C:\Documents and Settings\Owner\ths\src\DisplayCuboidValues\Cuboid.java:26: variable width might not have been initialized
    this.width = width;
    *^*
    C:\Documents and Settings\Owner\ths\src\DisplayCuboidValues\Cuboid.java:27: variable height might not have been initialized
    this.height = height;
    *^*
    Note: C:\Documents and Settings\Owner\ths\src\DisplayCuboidValues\DisplayCuboidValues.java uses unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    *3 errors*
    BUILD FAILED (total time: 0 seconds)
    Any help you can give me will be appreciated. Thanks.

    yeah. you are right in that. so that means that i have to get rid of it??. because i will need it. and the values assigned to them is in the first class that calls the second class look:
    package WindowsApplication1;
    * Summary description for Cuboid.
    //Import the classes to allow the use of the array, iterator and listiterator
    import java.util.ArrayList;
    import java.util.Iterator;
    import java.util.ListIterator;
    public class DisplayCuboidValues
         public static void main(String args[])
              //Create the array list
              ArrayList VolumeList = new ArrayList();
              //Create the counter to loop 4 times and get 4 different volumes. Modify the counter
              //if you need a different values
              int Counter = 1;
              //Initialize the counter to loop 4 times in order to get the 4 objects
              while (Counter < 5)
    *//HERE IS WHERE I AM PROVIDING THE OTHER CLASS WITH VALUES. THEREFORE IT SHOULD SENT THOSE VALUES TO MY CLASS CUBOID AND RETRIEVE THE ANSWER TO FOLLOW THE REST OF THIS CODE.*
                   Cuboid mp = new Cuboid(2, 4, 3);
                   //Add the values to the array
                   VolumeList.add(mp);
                   // get the volume again via accessor method(Optional)
                   //int Volume = mp.Volume();
                   //System.out.println(Volume);
                   //Increment the counter to obtain a new value in the array
                   Counter = Counter + 1;
              // Retrieve iterator to the radiuslist
              Iterator itr1 = VolumeList.iterator();
              while (itr1.hasNext())
              // call Cuboid.toString()
              System.out.print(itr1.next());
              System.out.println();
    }

  • Calling up class methods

    I suffer problems understanding how to call up class methods from within my programs and would like to see further examples of coding and a lending hand with the problem below, program one ProductClass works out stock item lines of a product, the program then needs to ask for the StaticProduct Class(the second program attached) to check for a valid barcode length and for how many odds and even numbers are within it a valid barcode would be 5000127062092
    I would very much appreciate some help:
    * This is a program to Enter and check product codes and prices
    * and give a summary of values at the end
    * @author (Jeffrey Jones)
    * @version (version 2 5th April 2003)
    public class ProcessProduct
    public static void main(String args[])
    StaticProduct Product = new StaticProduct();
    //declare variables
    String manuf;
    String name;
    int sLength;
    String p;
    String barcode;
    int price;
    int quantity;
    int totalPrice=0;
    int transactions=1;
    int totalQuantity=0;
    int totalValue=0;
    int averageCost=0;
    //Input Details
    System.out.print("Enter Product Manufacturer : ");
    manuf = UserInput.readString();
    //start of while loop checking for 0 to exit loop
    while (!manuf.equals("0"))
    System.out.print("Enter Product Name : ");
    name = UserInput.readString();
    System.out.print("Enter Bar Code : ");
    barcode = UserInput.readString();
    //check for invalid data
    if (StaticProduct.isValidBarcode(barcode))
    {barcode = new code();
                        p = new Product("manuf","name","quantity","price");
                        }//closing bracket of if
    else
    {//error handling
    }//closing bracket of if
    //check for quantity input and errors
    System.out.print("Enter Quantity : ");
    quantity = UserInput.readInt();
    if (quantity<=0)
    { System.out.print(" Error, invalid value ");
    System.exit(0);
    }// check for invalid entries
    System.out.print("Enter Price :");
    price = UserInput.readInt();
    //check for price input and errors
    if (price<=0)
    { System.out.print(" Error, invalid value ");
    }// check for invalid entries
    //total price value
    totalPrice=price*quantity;
    //Output of correctly inputted data
    System.out.println(manuf+":"+name+":"+barcode+":"+price);
    System.out.println(quantity+" @ "+price+" = "+totalPrice);
    //update variables quantities
    //update total quantity
    totalQuantity = (totalQuantity + quantity);
    //keep count of total value
    totalValue = (totalValue + totalPrice);
    //keep count of totqal no of transactions
    transactions = (transactions++);
    //Input Details
    System.out.print("Enter Product Manufacturer : ");
    manuf = UserInput.readString();
    }//closure of loop
    //display final totals
    System.out.println("Transactions: "+transactions);
    System.out.println("Total quantity: "+totalQuantity);
    System.out.println("Total value: "+totalValue);
    System.out.println("Average Cost: "+totalValue/totalQuantity);
    System.exit(0);
    }//closing bracket input and output of data
    }//end class
    * Write a description of class StaticProduct here.
    * @author Jeffrey Jones
    * @version 1 1st April 2003
    public class StaticProduct
    * isValidBarcode method - to check for correct barcode and length
    * @return boolean
    public static boolean isValidBarcode(String barcode) {
    barcode = new barcode();
    // validateBarcode length
    if ( barcode.length() != 13 ) {
    System.out.println("Invalid barcode " + barcode + " not 13 characters");
    return false;
    }//if
    for ( int i = 0; i < barcode.length(); i++ ){// Check every char a digit
    if ( ! Character.isDigit( barcode.charAt(i) ) ){
    System.out.println("Invalid barcode " + barcode + " not all digits");
    return false;
    }//if
    }//endfor
    int sum1 = 0; // Sum first + third + etc.
    for ( int i = 0; i < barcode.length() - 1; i += 2 ){
    sum1 += barcode.charAt(i) - '0';
    }//endfor
    int sum2 = 0; // Sum second + fourth + etc.
    for ( int i = 1; i < barcode.length() - 1; i += 2 ){
    sum2 += barcode.charAt(i) - '0';
    }//endfor
    int check = sum1 + 3 * sum2; // 1st sum + three times 2nd sum.
    check = check % 10; // Remainder on division by 10.
    if ( check != 0 ){
    check = 10 - check;
    }//endif
    if (check != barcode.charAt(12) - '0'){
    System.out.println("Invalid barcode " + barcode + " check digit error");
    }//endif
    return ( check == barcode.charAt(12) - '0' );
    }//end isValidBarcode
    public static void main(String[] argv) {
    System.out.println(isValidBarcode("1234567890123"));
    System.out.println(isValidBarcode("123"));
    System.out.println(isValidBarcode(""));
    System.out.println(isValidBarcode("5018374496652"));
    }//end main
    }//end class

    Read through your text book or some java tutorials from this site to understand what classes are, what are methods, etc.
    Your program is full of wrong initializations (as you rightly said you dont understand how to call up class method I would add that you dont understand how to call classes and what do they return e.g.
    You have declared
    String p;
    then you go ahead and do this
    p = new Product("manuf","name","quantity","price"); This is syntax for calling a class is this class returning a String? :s
    Please go through the basics of Object Oriented Programming and then start with the coding part else you will face such very many difficulties and waste more time of yours in just coding with no results.
    Look for the tutorials on this site and read through them and do example as given in them.

  • Compile and call the class during the runtime

    Hi guys,
    I am struggling with a project, which allow user to modify the behavior of the program.
    To do this, my Java code must be able to compile the Java code (*.java) and call the class from the code during the runtime.
    Here are my code:
    com.sun.tools.javac.Main javac = new com.sun.tools.javac.Main();
    String[] options = new String[] {"d:\\javaExternal\\RunTimeCompilation.java"};
    System.out.println(Main.compile(options));This allows me to compile the .java file into .class file. However, I can't find the way to access/use the .class file.
    Do you guys have solution for this?
    Thanks a lot.

    You will also need to investigate class unloading and proxies since presumably they can modify the file and compile it again.
    Might note that in general this seldom works for business solutions. It seems like allowing the users to add their own functionality would be a good idea so the programmers don't have to keep doing it. But the reality is that then the users must become programmers. And often must be pretty good at it as well since they must not only know the programming language but also the framework too. The second problem is that it also becomes a maintenance nightmare for the real developers to upgrade the existing system.

  • SYSTEM-CALL CONVERT ID no

    Dear Experts,
    What is the <no> in the below syntax ?
    Where can we get the info for which number is what ..
    SYSTEM-CALL CONVERT ID <no>
    I need this info for conversion of Binary data to ASCII.
    Thanks in advance.
    Regards,
    Matt.

    Hi,
    Pls refer the below SAP F1 Help.
    Conversion
    Note
    This statement is for internal use only.
    It cannot be used in application programs.
    Syntax
    CONVERT ID id DATA data ENCODING code ENDIAN endian IGNORE_CERR error N n POSITION position REPLACEMENT rep LEN len BUFFER buf AUX aux TYPE type.
    Effect
    Text and lines are converted between different formats.
    Note
    This statement is only provided for use in the conversion classes "CL_ABAP_CONV_...".

  • System call module questions.

    Hello,
    I am trying to create a system call module for solaris 2.6 (sparc).
    I am trying to avoid useing the /etc/name_to_sysnum file because I dont want my system calls to be dependant on a userland file. What I have done is this.
    static struct modlmisc modlmisc = {
    &mod_miscops,
    "Einstien system call driver"
    static struct modlinkage modlinkage = {
    MODREV_1,
    &modlmisc,
    NULL
    int
    _init(void)
    int error;
    if ((error = mod_install(&modlinkage)) < 0)
    return error;
    sysent[SYS_secctl].sy_narg = 6;
    sysent[SYS_secctl].sy_callc = (longlong_t (*)()) test;
    sysent[SYS_secctl].sy_flags = SE_LOADED | SE_NOUNLOAD | SE_ARGC;
         return 0;
    And this works, the only side effect is that my system calls do not have return values. Is there something else that I need to do (without makeing a specfic system call driver that depends on /etc/name_to_sysnum) to have correct return values ?

    See the Runtime class.
    http://java.sun.com/j2se/1.5.0/docs/api/index.html
    Also see the "gotchas" of using that class.
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html

  • From PL/SQL call java class present in Application server

    Hi,
    I need to call a java class file which is present on the application server. the call has to be made from pl/sql.
    I do not want to make use of the java stored procedures for this.
    Is there a way to call a class file residing on the application server from a pl/sql.
    Please help me out.
    Thanks & Regards
    Kamlesh

    New idea. DDL isn`t working but if i would make some DQL ? Like select??
    I`m trying to deploy java class like this:
    public class test {
         public static String say()
              throws SQLException{
                   Connection conn = new OracleDriver().defaultConnection();
                   String sql = "Select names from pdb_proteins where numbers=61";
                   try {
                        // Load the Oracle JDBC driver
                        Class.forName("oracle.jdbc.OracleDriver") ;
                        System.out.println("Oracle JDBC driver loaded ok.");
                        } catch (Exception e) {
                        System.err.println("Exception: "+e.getMessage());
                   try {
                        ResultSet rset = null;
                        PreparedStatement pstmt = conn.prepareStatement(sql);
                        rset=pstmt.executeQuery(sql);
                        String wynik = null;
                        wynik = rset.getString(1);
                        return wynik;
              } catch (SQLException e) {
                   System.out.println("Connection Failed! Check output console");
                   e.printStackTrace();
                   return "nope";
    Then invoke with PL/SQL function
    and i`m getting error ORA-29534: object SYSTEM.oracle/jdbc/OracleDriver
    Could someone help me with this? How i could register jdbc driver inside Oracle db??
    Edited by: Rado_mir on 2013-06-03 02:42

Maybe you are looking for