Invoke exe through java code(using java.lang.Runtime)

Iam trying to invoke an exe from java code.If i give the complete path for that exe it is running fine .But if i set the environment variable and directly execute the exe through command prompt it iss running fine , but it fails to run when i do the same using java code i.e. java.lang.Runtime.exec function

Give "//" for directory seperator.
E.g. r.exec("c://test//test.exe",null);
Why? That doesn't look correct.It is correct. It will work fine. Try it out.But it doesn't add or solve anything. A forward slash
does not need to be escaped.'
It's not even escaping. It's just doubling up. If that works, I'd bet "C://///test///////test.exe" does also.

Similar Messages

  • Changing java code using Java program

    hi All,
    I have some java classes, which i need to modify. The changes are mechanical, like putting finally block for the methods where there is a try block.
    Please suggest on how to write a small java program that will accomplish the task. Some code snippets may be helpful.
    Thanks,
    Raj.

    no, you got me wrong. After i add the finally blocks,
    i will perform the clean up tasks there. The first
    part of adding the finally blocks,i want to perform
    using a program.No you really don't want to do this.
    a) This will not be easy and in fact will be quite messy.
    b) It doesn't gain you anything anyway. As you yourself just noted you will have to put appropriate code in all those blocks anyway.
    So give this up and do it manually and for next time you will have learned that you should follow the standards from your project from the start.

  • How to check special characters in java code using Java.util.regex package

    String guid="first_Name;Last_Name";
    Pattern p5 = Pattern.compile("\\p{Punct}");
    Matcher m5 =p5.matcher(guid);
    boolean test=m5.matches();
    I want to find out the weather any speacial characters are there in the String guid using regex.
    but above code is always returning false. pls suggest.

    Pattern.compile ("[^\\w]");The above will match any non [a-zA-Z0-9_] character.
    Or you could do
    Pattern.compile("[^\\s^\\w]");This should match anything that is not a valid charcter and is not whitespace.

  • How can i return object from oracle in my java code using pl/sql procedure?

    How can i return object from oracle in my java code using pl/sql procedure?
    And How can i returned varios rows fron a pl/sql store procedure
    please send me a example....
    Thank you
    null

    yes, i do
    But i can't run this examples...
    my problem is that i want recive a object from a PL/SQL
    //procedure callObject(miObj out MyObject)
    in my java code
    public static EmployeeObj callObject(Connection lv_con,
    String pv_idEmp)
    EmployeeObj ret = new EmployeeObj();
    try
    CallableStatement cstmt =
    lv_con.prepareCall("{call admin.callObject(?)}");
    cstmt.registerOutParameter(1, OracleTypes.STRUCT); // line ocurr wrong
    //registerOutParameter(int parameterIndex, int sqlType,String sql_name)
    cstmt.execute();
    ret = (EmployeeObj) cstmt.getObject(1);
    }//try
    catch (SQLException ex)
    System.out.println("error SQL");
    System.out.println ("\n*** SQLException caught ***\n");
    while (ex != null)
    System.out.println ("SQLState: " + ex.getSQLState ());
    System.out.println ("Message: " + ex.getMessage ());
    System.out.println ("Vendor: " + ex.getErrorCode ());
    ex = ex.getNextException ();
    System.out.println ("");
    catch (java.lang.Exception ex)
    System.out.println("error Lenguaje");
    return ret;
    Do you have any idea?

  • Execute MSIL code using JAVA

    How can I execute MSIL code using java?

    Thanks for your reply. I did it in google and didn't find any useful think.
    I just want to know is there any technique in java or already written product that can do that.
    Any advice will be helpful. Thanks

  • Need a java code using swing that can do master configuration

    I need a java code using swing that can do master configuration.For example, in the 1st screen it will show all configuration checke boxes . According to those selected check box, it will show the needed panels sequentially and finnaly it will update many xml files.

    TapasB wrote:
    I need a java code .......and I wish you much luck in creating it. Please come back if you have a specific question on a specific part of your code that is not working quite right.

  • Deploying no java applications using Java Web Start

    Hi,
    I am new to java web start. Is it possible to distribute non java applications using java web start. I have an APP which can run on a desktop in standalone mode. The app has jusy HTML and Java script files. Is it possible to package this app and deploying using java web start? I am assuming If it is possible, I can make updates to the packaged app in the web servers and the updates will be downloaded next time the app is used provided configurations are correct?
    thx

    The app has jusy HTML and Java script files. Is it possible
    to package this app and deploying using java web start? Not really. Resources for JWS need to be zipped,
    while this HTML/JS app. will (I guess) not work from
    inside the depths of a Jar (or Zip) archive.
    Note that you can organise for those files to be
    downloaded and expanded onto a known place
    on the user's disk, by using an 'installer' element,
    but..
    ...I am assuming If it is possible, I can make updates to the
    packaged app in the web servers and the updates ..installers are only called once, and do not 'update'.

  • Get Native Java Window using Java Access Bridge 2.0.1 & Java 1.6 and above

    I want to get the native java window (Like Java Monkey Application and Java Ferret Application) using java only, for that I tried different ways/options but unable to get the native java window and perform actions on that.
    It would be really great if you could guide me for that. I am still unable to start the Java Access Bridge.
    Please let me know the steps to get native java window using Java Access bridge and JDK 1.6.20.
    Also Note that, As per your previous suggestion, I tried to search and call initializeAccessBridge() and shutdownAccessBridge(), But unable to succeed it. I did not find such method in Accessbridge.jar.
    Please help me out.
    Best Regards

    You might want to check out this thread:
    Java Access Bridge and JRE 1.6
    If you have Java 6, you'll need to manually install Java Access Bridge 2.0.1. The JAB 2.0.2 installer for Java 6 is also available as a beta:
    http://jdk6.java.net/6uNea.html

  • How Can I execute a java program using java code?

    {color:#000000}Hello,
    i am in great trouble someone please help me. i want to execute java program through java code i have compiled the java class using Compiler API now i want to execute this Class file through java code please help me, thanks in advance
    {color}

    Thanks Manko.
    i think my question was not clear enough.. actually i want to run this class using some java code . like any IDE would do i am making a text editor for java, as my term project i have been able to complie the code usign compiler api and it genertaes the class file but now i want to run this class file "THROUGH JAVA CODE" instead of using Java command. I want to achive it programatically. do you have any idea about it.. thanks in advance

  • Sample JAVA code using Resource Adapter for RFC Connections

    Hi Java Knowledgeable Ones.
    I have successfully deployed the SAP Netweaver J2ee Engine "Resource Adapter for RFC Connections to ABAP Systems" to my Web Application Server.  Now I need to develop a JAVA application that would utilize this deployed resource adapter.  The resource adapter specifies the SAPClient, UserName, and password.  I am thinking that the JAVA code to invoke this connection would therefore not need to provide this information as it should be available in the resource adapter.
    Do you have sample code that you could send to me showing how to do this?
    Thanks,
    Kevin

    Hi Kevin,
    this is actually no good style! You should not open the connection with the adaptor knowing the password. Usually it should work via a connection that uses only basic rights  and the user has already authenticated and is using his security ticket.
    For security handling see:
    http://help.sap.com/saphelp_nw04/helpdata/en/61/f8bc3d52f39d33e10000000a11405a/frameset.htm
    Regards,
    Benny

  • Login codes using java database (validates with Microsoft Access File)

    hi all pro-programmer, can you show me the code to login with the username and password using java database. When the user enters the username and password in the login page then it will go to the requested page. may i know how to do it?

    no one will give you complete code.
    i'll lay out the pieces for you, though:
    (1) start with a User object. give it username and password attributes.
    (2) write a UserDAO interface with CRUD operations for a User object.
    (3) write a UserDAOImpl for your Microsoft Access database
    (4) write an AuthenticationService interface
    (5) write an implementation of the AuthenicationService that works with the UserDAO to authorize a User.
    Use a servlet to accept request from your login page and pass it off to the service. Voila.
    PS - Here's skeleton to start with. UI, servlet, and controller are your responsibility:
    package model;
    public class User implements Serializable
        private String username;
        private String password;
        public User(String u, String p)
            this.username = u;
            this.password = p;
        public String getUsername() { return username; }
        public String getPassword() { return password; }
    public interface UserDAO
        public User findByUsername(String username);
        public void saveOrUpdate(User user);
        public void delete(User user);
    public class UserDAOImpl implements UserDAO
        private Connection connection;
        public UserDAOImpl(Connection connection)
            this.connection = connection;
        public User findByUsername(String username)
            String password = "";
            // logic for querying the database for a User
            return new User(username, password);
        public void saveOrUpdate(User user)
            // save or update a User
        public void delete(User user)
            // delete a User
    public interface AuthenticationService
        public boolean isAuthorized(String username);
    public class AuthenticationServiceImpl implements AuthenticationService
        private UserDAO userDAO;
        public AuthenticationServiceImpl()
            // Create a database connection here and the UserDAO, too.
        public boolean isAuthorized(String username)
            boolean isAuthorized = false;
            // Add logic to do the database query and decide if the username is authorized
            return isAuthorized;       
    }

  • Monitor java code using BAM

    Hi,
    I am new to BAM, and I have a specific use case, for which I couldnt find any doc in the web. I want to monitor a java code at different point using BAM. To be in more detail, I would like to add sensors at different location in my java code, which would possible push it to JMS queue and BAM monitors those data objects.
    Thanks,
    Sudarsan M

    Hi Sudarshan,
    Please look in the blog entry below that demonstrate how you can feed BAM Data objects by listening to JMS Queue/Topic.
    http://beatechnologies.wordpress.com/2011/05/20/integrating-oracle-bam-11g-with-bpel-jms-sensor-action/
    The example in the blog illustrate how a BPEL process uses a JMS Sensor action to publish Data to a JMS Queue and from there how it is picked up by External Message Sources in BAM.
    For your use case you can write a small client code to post an XML message from your Java Class to a Queue in Weblogic.
    Hope it helps.

  • Error -- Java code using OIM API to find no of users in OIM

    Hi Experts,
    I hav a requirement that I need to query OIM to find out the total no of active users in the system using a stand alone java program to determine some other process. So I have developed a simple java code but it fails in the below line
    rset=userIntf.findAllUsers(map);  -- It throws null pointer exception
    I have tried with deleteUser() instead of findUsers() , still it throws the null pointer exception on the same line.I have checked the other posts in the forum but could not find out where is the mistake. Can u please suggest me??
    Here is the code
    System.setProperty("XL.HomeDir","D:/bea-oim/xellerate");
    System.setProperty("java.security.auth.login.config","D:/bea-oim/xellerate/config/authwl.conf");
    System.setProperty("java.security.policy","D:/bea-oim/xellerate/config/xl.policy");
    System.setProperty("log4j.configuration","D:/bea-oim/xellerate/config/log.properties");
    tcUtilityFactory utilityFactory = null;
    tcUserOperationsIntf userIntf = null;
              try
                   tcResultSet rset;
                   ComplexSetting config = ConfigurationClient.getComplexSettingByPath("Discovery.CoreServer");
                   final Hashtable env = config.getAllSettings();
                   tcSignatureMessage moSignature = tcCryptoUtil.sign("xelsysadm","PrivateKey");
                   utilityFactory = new tcUtilityFactory(env, moSignature);
                   userIntf=(tcUserOperationsIntf)utilityFactory.getUtility("Thor.API.Operations.tcUserOperationsIntf");
                   HashMap map = new HashMap();
                   map.put("Users.Status","Active");
                   rset=userIntf.findAllUsers(map);
    System.out.println(rset.getRowCount());
         catch(NullPointerException ne)
         System.out.println(ne.getMessage());
         ne.printStackTrace();
         catch(Exception e)
         System.err.println(e.getMessage());
         e.printStackTrace();
    Thanks & Regards
    INIYA

    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    import java.util.HashMap;
    import java.util.Properties;
    import java.util.*;
    import Thor.API.tcUtilityFactory;
    import Thor.API.Operations.*;
    import Thor.API.tcResultSet;
    import com.thortech.xl.crypto.tcCryptoUtil;
    import com.thortech.xl.util.config.ConfigurationClient;
    * @author Rajiv
    public class CreateBulkUsers {
    public static void main(String args[])
    System.setProperty("XL.HomeDir", "E:\\oim\\server\\xellerate");
    System.setProperty("java.security.auth.login.config", "E:\\oim\\server\\xellerate\\config\\auth.conf");
    System.setProperty("java.security.policy", "E:\\oim\\server\\xellerate\\config\\xl.policy");
              tcUtilityFactory utilityFactory = null;
    tcUserOperationsIntf userIntf = null;
    try
    com.thortech.xl.util.config.ConfigurationClient.ComplexSetting config = ConfigurationClient.getComplexSettingByPath("Discovery.CoreServer");
    java.util.Hashtable env = config.getAllSettings();
    com.thortech.xl.crypto.tcSignatureMessage moSignature = tcCryptoUtil.sign("xelsysadm", "PrivateKey");
    utilityFactory = new tcUtilityFactory(env, moSignature);
    // System.out.println((new StringBuilder()).append("utilityFactory = ").append(utilityFactory).toString());
    userIntf = (tcUserOperationsIntf)utilityFactory.getUtility("Thor.API.Operations.tcUserOperationsIntf");
    HashMap map = new HashMap();
    map.put("Users.Status", "Active");
    tcResultSet rset = userIntf.findAllUsers(map);
    System.out.println(rset.getRowCount());
    catch(NullPointerException ne)
    System.out.println(ne.getMessage());
    ne.printStackTrace();
    catch(Exception e)
    System.err.println(e.getMessage());
    e.printStackTrace();
    Include all the JARs to run this class from outside not only of OIm of JBoss or Weblogic also.
    eg: jboss\client and jboss\lib

  • Reverse-Engineer Java Code using JDeveloper

    Hi,
    Is it possible to reverse-engineer java code and produce class diagrams in JDeveloper? If so , how?
    I have JDeveloper 10g.
    Thanks

    Yes you can.
    Just open the java classes in a JDeveloper project, create a new class diagram and drag the classes onto the empty diagram.

  • Tips on how to write efficient  java code for java mapping

    hi
    I do not have much knowledge in Java
    Can anybody tell me some tips on how to write efficient and optimised java code to be used in java mapping
    Thanks,
    Loveena

    hi D'za,
    JAVA in xi
    A very important place where you will use JAVA in XI is while doing your Mapping. There will be cases when JAVA MAPPING is the best solution to go for. There are 2 types of Parsers available for JAVA Mapping. DOM Parser and SAX parser. Just got through the following links to understand more on Java Mapping and the APIs available.http://java.sun.com/j2se/1.4.2/docs/api/javax/xml/parsers/package-summary.html http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/Document.html http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/package-frame.html /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i
    /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii
    JAVA mapping -
    /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii /people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-iii /people/ravikumar.allampallam/blog/2005/06/24/convert-any-flat-file-to-any-idoc-java-mapping /people/amol.joshi2/blog/2006/03/10/think-objects-when-creating-java-mappings /people/sameer.shadab/blog/2005/09/29/testing-abap-mapping
    sample code for java mapping
    Re: Example code DOM PARSER API -
    http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/package-frame.html DOM --- /people/thorsten.nordholmsbirk/blog/2006/08/10/using-jaxp-to-both-parse-and-emit-xml-in-xi-java-mapping-programs tutorial sax and dom
    For a tutorial on the methods of SAX and DOM http://java.sun.com/webservices/docs/1.1/tutorial/doc/
    SAX AND dom PARSER ( BY thorsten) -
    example /people/thorsten.nordholmsbirk/blog/2006/08/10/using-jaxp-to-both-parse-and-emit-xml-in-xi-java-mapping-programs java mapping example ( testing and debugging) /people/stefan.grube/blog/2006/10/23/testing-and-debugging-java-mapping-in-developer-studio
    regards
    biplab
    Use a Good Subject Line, One Question Per Posting - Award Points

Maybe you are looking for