2 Replies Latest reply on Feb 15, 2013 5:22 AM by Nicklas Karlsson

    CLI Java API anomaly?  do Windows absolute paths work?  API seems confused by "c:\\"

    Steven Boscarine Apprentice

      Hi.

      I am having issues scripting using the Java CLI API. 

      C:\\Users\\sboscarine\\installer\\ojdbc6.jar is a valid file.  I have confirmed this by path from a java.io.File object and confirming it's existence first.

      #fails
      module add --name=com.oracle.jdbc2 --resources=C:\\Users\\sboscarine\\installer\\ojdbc6.jar --dependencies=javax.api,javax.transaction.api
      #succeeds
      module add --name=com.oracle.jdbc2 --resources=//Users/sboscarine/installer/ojdbc6.jar --dependencies=javax.api,javax.transaction.api
      

       

      • Am I doing something wrong?
      • Is there a way to get a path that this API recognizes?  I want to automate the deployment of our application on Windows and Linux.

       

      Here's the code I am using:

       

        public void testCLI() {
          org.jboss.as.cli.scriptsupport.CLI cli = org.jboss.as.cli.scriptsupport.CLI.newInstance();
          cli.connect();
          // make sure module doesn't already exist.
          try {
            cli.cmd("module remove --name=com.oracle.jdbc2");
          } catch (Exception e) { /* I don't care what this returns. */
          }
          //fails  Also, fails with path returned by java.io.File.getAbsolutePath())
          try {
            cli.cmd("module add --name=com.oracle.jdbc2 --resources=C:\\Users\\sboscarine\\installer\\ojdbc6.jar --dependencies=javax.api,javax.transaction.api");
          } catch (Exception e) {
            e.printStackTrace();
          }
          // remove 
          try {
            cli.cmd("module remove --name=com.oracle.jdbc2");
          } catch (Exception e) { /* I don't care what this returns. */
          }
          //works
          try {
            cli.cmd("module add --name=com.oracle.jdbc2 --resources=//Users/sboscarine/installer/ojdbc6.jar --dependencies=javax.api,javax.transaction.api");
          } catch (Exception e) {
            e.printStackTrace();
          }
          cli.disconnect();
        }