Specify a exe running from certain directory from java program

Hi there,
I had a java program, which will spawn some child process to run vb COM;
what I wanted to do: have a child process start the COM from a specific diretory?
IS there any way to do it from Java, like shell programming?
Thanks

I do all my portable shell stuff now in ant.. http://jakarta.apache.org/ant/
it is an XML driven java script for doing builds.. but it can be used for shell scripting.
They are also some java scripting languages like jPython but i am not very familiar with them.
u can also get Cygwin and write unix shell scripts. www.cygwin.com
hope this helps

Similar Messages

  • Exclude postings from certains accounts from Project Settlement

    Hi,
    I would like to know if there is a certain config that could exclude postings of CERTAIN ACCOUNTS from Project settlement.
    Thanks!
    Vivian

    Hi,
    May I know if you are referring to OKO6 config? We have no included any of those unwanted cost elements for settlement, but during settlement we are getting error saying that allocation structure not complete - so we need to find a way for system to totally exclude posting from those accounts for settlement (instead of showing error)
    Thanks!
    Vivian

  • How to retrive an Email ID from Microsoft Outlook in Java Programming ?

    Hi,
    Requirement : How would I get the Email lD from Outlook.
    I am developing an application where I receive a mail from it
    in that mail I have two Button One is "Approve" and other is "Reject".
    On each button I had written the separate code.Now I had not put any validation of email ID.
    Like if person who receive a mail who is authorized send a mail to another person for some analysis.
    Here the button are visible to 3rd person so he can go ahead click on button and approve and reject the request.
    To avoid this issue I need your assistance regarding how would I get the email id from outlook
    to which email had sent.
    So I can compare the email ID which I had received from the outlook and
    mail id which I had send it from my application.
    Regards,
    Tushar.

    see this
    outlook - Retrieving mails from MS Exchange Server from Java application - Stack Overflow
    java - How to read email of outlook with javamail? - Stack Overflow
    http://stackoverflow.com/questions/19623068/java-program-to-check-periodically-ms-outlook-for-new-mail

  • Pass in date from shell script to java program

    Hi,
    I need to pass in some parameter to my java program.
    eg 'java SomeProgram yyyy mm dd hh mm ss'
    How do i use the shell script to generate the valeus for the year, mth day etc?
    The program is running once everyday.
    I tried $argu0 = `date+%y`
    java SomeProgram $argu0
    but not working... thanks for your help!

    Then, why would you want to use 'date' to provide
    'now' to a Java program when you could just use new
    java.util.Date() which probably makes the same call
    as the Unix 'date' command?That works until you need to use a date other than 'now.'
        public static final String ISO_DATE = "yyyy-MM-dd HH:mm:ss";
        public static void main(String[] args) {
            SimpleDateFormat sdf = (SimpleDateFormat) SimpleDateFormat
                    .getDateTimeInstance();
            sdf.applyPattern(ISO_DATE);
            try {
                Date d = sdf.parse(args[0]);
                // rest of code here
            } catch (ParseException e) {
                // handle exception
        }Users will have to enclose there input with quotes otherwise the JVM will consider their input as two parameters, or you can change the pattern to include a character between dd and HH.

  • Determin current working directory using java program

    HI:
    I would like to know is there anyway that I can determine what my current working directory is, using a java program??
    Thanks,
    Sincerely,
    Karen

    Properties sysProperties = System.getProperties();
    String currDir = sysProperties.get("user.dir");Here's a list of all the properties you can get from sysProperties:
    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/System.html#getProperties()

  • Run Perl script in my Java program

    Some say that the following statement can run Perl script in Java program:
    Runtime.getRuntime().exec("C:\\runPerl.pl");
    But when I run it, it'll throw IOException:
    java.io.IOException: CreateProcess: C:\runPerl.pl error=193
    at java.lang.Win32Process.create(Native Method)
    at java.lang.Win32Process.<init>(Win32Process.java:63)
    at java.lang.Runtime.execInternal(Native Method)
    at java.lang.Runtime.exec(Runtime.java:566)
    at java.lang.Runtime.exec(Runtime.java:428)
    at java.lang.Runtime.exec(Runtime.java:364)
    at java.lang.Runtime.exec(Runtime.java:326)
    at test.runPerl.main(runPerl.java:16)
    Exception in thread "main"
    Where is the problem? In fact, I do have a Perl script named "runPerl.pl" in my C:/ directory. Why can't it be run?

    Please don't crosspost
    http://forum.java.sun.com/thread.jspa?threadID=703918

  • Running a process within a java program

    Hi
    I have code that runs a process for performance monitoring on an installed system. When I run the code standalone as below, it runs fine. If I include the code below inside another java program, the process fails to execute and the status returned is non-zero (failed to execute).
    The process requires the PATH and LD_LIBRARY_PATH to be set which seem to be set correctly when i print them out. So, I am not sure why the process doesnot run when included within another running java program.
    Can someone please point out what I maybe missing?
    Thanks!!
    public class RunPerf
      private static final String CLASS_NAME = "RunPerf"; private static Process proc = null;
    public static void main(String[] args)
        String INSTALLPERF_SAW_UNIX_COMMAND = "sawexe" + " " + "-perf";
             StringBuffer path1 = new StringBuffer(30);StringBuffer ldlibpath1 = new StringBuffer(30);
        System.setProperty("user.home", "/home/user");
        StringBuilder commandToExecute = new StringBuilder();
       commandToExecute.append(System.getProperty("user.home"));
       commandToExecute.append(File.separator);
       commandToExecute.append("web");
       commandToExecute.append(File.separator);
       commandToExecute.append("bin");
       commandToExecute.append(File.separator);
         String path = System.getProperty("user.home")+"/server/bin/" + File.pathSeparator + System.getProperty("user.home")+ "/web/bin";
           path1.append( path );
           path1.append( File.separator );
           path1.append( System.getProperty("java.library.path") );
           path1.append( File.separator );
          String env_value = null;
         String[] ldargs = {"LD_LIBRARY_PATH"};
         for (String env: ldargs) {
                env_value = System.getenv(env);
             System.out.println("LD_LIBRARY_PATH value before setting property= " + env_value);
                if (env_value != null) {
               String newldlibpath = System.getProperty("user.home")+ "/server/bin/" + File.pathSeparator + System.getProperty("user.homee")+ "/web/bin" ;
                ldlibpath1.append(newldlibpath);
                ldlibpath1.append(File.separator);
                   ldlibpath1.append(env_value);
                   ldlibpath1.append( File.separator);
                    System.out.format("%s=%s%n", env,ldlibpath1.toString());
                } else {
                    System.out.format("%s is not assigned.%n", env);
                 commandToExecute.append(INSTALLPERF_SAW_UNIX_COMMAND);
                   String[] envp =   { "USER_HOME =" + "/home/user",          "PATH=" + path1.toString(), "LD_LIBRARY_PATH=" + ldlibpath1.toString() };
               int status = executeCommand1(commandToExecute.toString(), envp,null);
                   if(status != 0){
                          System.out.println("Unable to run perf Unix") ;
         public static int executeCommand1(String command,String[] envp, Logger logger) {
            String METHOD_NAME = "executeCommand1";
            if (logger == null) { logger = Logger.getAnonymousLogger();}
            logger.entering(CLASS_NAME, METHOD_NAME, new Object[] { command, envp});
            Runtime runtime = Runtime.getRuntime();
            runtime.addShutdownHook(new Thread() {
                        public void run() {
                            if (proc != null) {     try {  proc.destroy();  if (proc != null) { proc.destroy();  }
                                } catch (Exception e) {
                                    e.printStackTrace(); }      }      }     });               
                           int retVal = 0;
          File cwd = new File(System.getProperty("user.home")+ "/web/bin/");               
                           try {
                               if (envp != null) {   proc = runtime.exec(command, envp,cwd); }
                                       else {  proc = runtime.exec(command); }
                               Thread t_err =        new Thread(new StreamReader(proc.getErrorStream()));
                               t_err.start();
                               Thread t_in =     new Thread(new StreamReader(proc.getInputStream()));
                               t_in.start();
                               retVal = proc.waitFor(); } catch (IOException e) {        retVal = -1;   logger.severe("IOException");      }
                                     catch (Exception e) { retVal = -1;        logger.severe("Exception");                  }
                     logger.exiting(CLASS_NAME, METHOD_NAME, retVal);
                     return retVal;
    static class StreamReader implements Runnable {
            InputStream in;
            public StreamReader(InputStream genericStream) {   in = genericStream;   }
            public void run() {
                try {
                    String strTemp = null;
                    BufferedReader buffReader = new BufferedReader(new InputStreamReader(in));
                    while ((strTemp = buffReader.readLine()) != null) {
                        System.out.println(strTemp);                }
                } catch (Exception e) {               e.printStackTrace();            }        }    }}

    Either set up a script before the program runs or have the
    program write a script file which contains the statements
    that need to be executed. Then you will be able to
    execute the script with a call to
    Runtime.getRuntime().exec()Mark

  • Can't use certain characters in java programs.

    For some reason I cannot use characters like: " ^ ~ | " in java programs.
    I can type them in a terminal and then paste them into the program, but cannot type them inside the java program - It's has been like that in every java application I have used. It only works when typing them in a applet running on a browser.
    Im running Linux RH 7.2 with JDK1.4.0 (It works fine in windows 2000)
    Hope somebody can help me.
    /Tommy

    Ehmm. What makes you believe that it isnt?
    I can't make exclusiveOr operations and if(bubba || bubba2) something....And that is a problem / annoyance.
    I can type every other characters but those ��� works fine as well.

  • Running Batch file thru a java program

    hai friends
    i have a batch file like hello.bat
    how can i run that batch file when i run my java program
    i heard that Runtime.exec() is used to run the batch files.
    can i use Runtime.exec() to run my hello.bat file or any other things i need to use ?
    Thankyou VeryMuch
    Yours
    Rajesh

    Yes, you can use Runtime. You should look it up in your API guide, but this code might get your started:
            try
                Process p = runtime.exec("command.com /c c:\\hello.bat");
            catch(IOException e)
                System.out.println("Failed");
            }Your API guide will explain how to get a Runtime object. The syntax is very straightforward.

  • How do i specify path to a lower level directory from a higher level?

    or vica versa?
    i.e. I am in the following directory jspsource/labels/template1.
    There is a file in that folder called index.jsp. I want to include a file in folder jspsource called home1.jsp.
    How do i do it using jsp?
    <%@ include file = "../Home1.jsp" %>
    the above didnt work.

    how would i do that? Im a beginner so would be
    grateful if u could demonstrate with an example.The relative path to the application context starts at the top most folder of your application. If your application is called MyApp and the folder structure is
    - some web server
    - projects
    - domain
    - apps
    - MyApp
    -jspsource
    -labels
    -template1
    - Home1.jsp
    then you would have the following include statement:
    <%@ include file = "MyApp/jspsource/labels/template1/Home1.jsp" %>

  • Copying files from same directory as *.java files and moving to WEB-INF/classes/ package name

    In our current application we have the following source directory structure:
              src -
              - com
              - edeploy
              - subdirs ... (many directories here)
              - jsp
              -subdirs ... (many directories here)
              In com.edeploy.subdirs, there exists *.java files, and *.gxq files (query
              files). I would like to modify my build.cmd script to copy the *.gxq files
              into the same directory as the class files.
              Here's my script so far:
              @REM Create list of files to compile
              DIR /S /B /A:-D src\com\*.java >class.list
              @REM Create list of query files
              DIR /S /B /A:-D src\com\*.gxq >query.list
              @REM Compile
              javac -d stage\WEB-INF\classes @class.list
              @REM Copy query files into class directory
              .......... code needed here ......
              Can anyone help me with this?
              Thanks,
              Matt
              

    You may want to check out:
              http://jakarta.apache.org/ant/index.html
              Gary
              "Matt Raible" <[email protected]> wrote in message
              news:[email protected]..
              > In our current application we have the following source directory
              structure:
              >
              > src -
              > - com
              > - edeploy
              > - subdirs ... (many directories here)
              > - jsp
              > -subdirs ... (many directories here)
              >
              >
              > In com.edeploy.subdirs, there exists *.java files, and *.gxq files (query
              > files). I would like to modify my build.cmd script to copy the *.gxq
              files
              > into the same directory as the class files.
              >
              > Here's my script so far:
              >
              > @REM Create list of files to compile
              > DIR /S /B /A:-D src\com\*.java >class.list
              >
              > @REM Create list of query files
              > DIR /S /B /A:-D src\com\*.gxq >query.list
              >
              > @REM Compile
              > javac -d stage\WEB-INF\classes @class.list
              >
              > @REM Copy query files into class directory
              > .......... code needed here ......
              >
              > Can anyone help me with this?
              >
              > Thanks,
              >
              > Matt
              >
              >
              

  • How do use an Import Command from DB2 into a java program

    I have to use a csv file to load data into a table, after connecting to the database and using the execute, it does not recognise the import statement.
    How do i import that file into a table using a java program

    Import is a DB2 utility program which uses sql Insert to write data into a table. Insert is called from the CLP (command line processor), not from Java. If you want to do this job using Java, then you need to establish a connection to the database, and write your own sql insert statements.

  • Problem while calling a Webservice from a Stand alone java program

    Hello Everyone,
    I am using a java program to call a webservice as follows. For this I have generated the client proxy definition for Stand alone proxy using NWDS.
    Now when I call the method of the webservice I am getting the correct result but along with the result I am getting one error and one warning message in the output.
    The java code to call the webservice is as follows.
    public class ZMATRDESCProxyClient {
         public static void main(String[] args) throws Exception {
              Z_MATRDESC_WSDService ws = new Z_MATRDESC_WSDServiceImpl();
              Z_MATRDESC_WSD port = (Z_MATRDESC_WSD)ws.getLogicalPort("Z_MATRDESC_WSDSoapBinding",Z_MATRDESC_WSD.class);
              String res = port.zXiTestGetMatrDesc("ABCD134");
              System.out.print(res);
    The result I am getting is :
    Warning ! Protocol Implementation [com.sap.engine.services.webservices.jaxrpc.wsdl2java.features.builtin.MessageIdProtocol] could not be loaded (NoClassDefFoundError) !
    Error Message is :com/sap/guid/GUIDGeneratorFactory
    <b>Material Not Found</b> -
    > This is the output of webservice method and it is right.
    Can any one please let me know why I am getting the warning and error message and how can I fix this.
    Thanks
    Abinash

    Hi Abinash,
    I have the same problem. Have you solve that problem?
    I am using a java program to call a webservice too. And I have generated the client proxy definition for Stand alone proxy using NWDS. When I call the method of the webservice I am getting the correct result but along with the result I am getting one error and one warning message in the output.
    The java code to call the webservice is as follows.
    MIDadosPessoaisSyncService service = new MIDadosPessoaisSyncServiceImpl();
    MIDadosPessoaisSync port = service.getLogicalPort("MIDadosPessoaisSyncPort");
    port._setProperty("javax.xml.rpc.security.auth.username","xpto");
    port._setProperty("javax.xml.rpc.security.auth.password","xpto");
    String out = port.MIDadosPessoaisSync("xpto", "xpto");
    System.out.println(out);
    The result I am getting is :
    Warning ! Protocol Implementation [com.sap.engine.services.webservices.jaxrpc.wsdl2java.features.builtin.MessageIdProtocol] could not be loaded (NoClassDefFoundError) !
    Error Message is :com/sap/guid/GUIDGeneratorFactory
    <b>The result of the WS is correct!!!</b>
    The Java project does not have any warning. But the stand alone proxy project has following warnings associated with it.
    This method has a constructor name     MIDadosPessoaisSync.java     
    The import javax.xml.rpc.holders is never used     MIDadosPessoaisSyncBindingStub.java     
    The import javax.xml.rpc.encoding is never used     MIDadosPessoaisSyncBindingStub.java     
    The constructor BaseRuntimeException(ResourceAccessor, String, Throwable) is deprecated     MIDadosPessoaisSyncBindingStub.java
    It is very similar with your problem, could you help me?
    Thanks
    Gustavo Freitas

  • Running a .jar with a java program on unix

    I am trying to run a jar file with this java code but when i run it, it comes up with built successfully but the file doesn't run.
    ps- I use a unix os
    public class Main {
    public static void main(String args[]) throws IOException, InterruptedException {
    // first method i tried:
    Runtime.getRuntime().exec( new String[] {"/bin/sh", "-c",
    "/Users/cb/NetBeansProjects/MultiCalc/dist/MultiCalc.jar output.out ascii workload2.trace 0"});
    //second method i tried:
    ProcessBuilder pb = new ProcessBuilder( new String[] {"/bin/sh", "-c",
    "/Users/cb/NetBeansProjects/MultiCalc/dist/MultiCalc.jar"});
    pb.redirectErrorStream( true );
    pb.start();
    thanks a lot in advance!

    javalavaguava-- wrote:
    I am trying to run a jar file with this java code but when i run it, it comes up with built successfully but the file doesn't run.
    ps- I use a unix os
    public class Main {
    public static void main(String args[]) throws IOException, InterruptedException {
    // first method i tried:
    Runtime.getRuntime().exec( new String[] {"/bin/sh", "-c",
    "/Users/cb/NetBeansProjects/MultiCalc/dist/MultiCalc.jar output.out ascii workload2.trace 0"});
    //second method i tried:
    ProcessBuilder pb = new ProcessBuilder( new String[] {"/bin/sh", "-c",
    "/Users/cb/NetBeansProjects/MultiCalc/dist/MultiCalc.jar"});
    pb.redirectErrorStream( true );
    pb.start();
    thanks a lot in advance!I don't see any mention of 'java' when trying to execute the jar file. You have to specify which application should process a jar file - it doesn't magically know to use java.
    P.S. You should read the 4 sections of [http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html|http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html] and implement ALL the recommendations.

  • Calling a function in an EXE file from Java Program

    Hi Im having a function which is written in c program.i need to call that function from my java program, if i create a shared library (DLL) for my C code then it works but my requirement is i dont want to create that DLL , like in it would be an executable and my java code should access that function in that C program

    I understand the usage od a DLL but the thing is if i convert the exe to a DLL
    the server doesnt start at all so what i need is that i dont want to change
    that .EXE into a .DLL,let it be an executable. that executable is in running mode
    and through my java program i need to call a function in that EXE file.
    Is ther any way to do it?Nope, but you have another problem: why can't you separate your server program
    into a .dll part and a startup part? Both, when properly linked against each other
    should give you an executable file.
    kind regards,
    Jos

Maybe you are looking for

  • Does anyone know how to show the year in the menubar?

    I've never been able to do this. YouControl.app did do it but sadly the developer is no longer supporting it.

  • Sound Issues in XP

    I have installed XP on a few iMac no problems. However on my friends iMac (2.4ghz) the internal mic is not working. Its is the default audio input, and the volume is turned up full in Volume Control but Im getting nothing. I also tried the Hardware T

  • Subject & Message content in emails from XI

    All, We need to send an email from the XI system. The message that we use is the following, <target> <name> John Doe</name><designation>manager</designation> <name> Mary Jane</name><designation>supervisor</designation> <name> Foo Bar</name><designati

  • Poll: How much music do you ha

    So the thread "Computer Illiterate and looking to buy mini Zen" inspired me to a new forum topic, and a quick search showed nothing, so I'm wondering: How much music (gb or number-wise) do you have? While I don't have access to my music at home right

  • Setting up GST in purchasing

    I am trying to set up GST for Singapore to be calculated on a purchase order.  I enter the tax code on the purchase order and get a tax calculation from the tax procedure.  However, I want this calculation to appear in the calculation schema of the p