<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: java procedure call os command in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/java-procedure-call-os-command/m-p/4187578#M14577</link>
    <description>It's not obvious (to me) what you are trying to do. I just want to point out what Java can execute: executable files.&lt;BR /&gt;&lt;BR /&gt;In a Unix environment these are programs and (shell/perl...) scripts. In a VMS environment these are images and DCL command procedures.&lt;BR /&gt;&lt;BR /&gt;You can not execute a Unix shell command or a VMS DCL command. For example, a VMS command "show sys" can not be executed from Java.&lt;BR /&gt;&lt;BR /&gt;Other examples are "ls -l *.txt" or "DIR/FULL *.TXT". Both will not work if run from Java for the same reasons: both require a shell or DCL to be activated.&lt;BR /&gt;&lt;BR /&gt;As a workaround, you may be able to run the command as a one-line input to the shell/DCL. On Unix this can be done with "sh -c \"ls -l *.txt\"". On VMS you may get it to work with the GNV DCL.EXE wrapper "gnu:[bin]dcl.exe \"DIR/FULL *.TXT\"".</description>
    <pubDate>Mon, 28 Apr 2008 07:12:17 GMT</pubDate>
    <dc:creator>x2084</dc:creator>
    <dc:date>2008-04-28T07:12:17Z</dc:date>
    <item>
      <title>java procedure call os command</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/java-procedure-call-os-command/m-p/4187576#M14575</link>
      <description>os: openvms&lt;BR /&gt;database: oracle 10g&lt;BR /&gt;i want call os command in plsql,the method is that:&lt;BR /&gt;&lt;BR /&gt;conn / as sysdba&lt;BR /&gt;SQL&amp;gt; EXEC DBMS_JAVA.grant_permission('TEST', 'java.io.FilePermission', '&amp;lt;&lt;ALL fi=""&gt;&lt;/ALL&gt;LES&amp;gt;&amp;gt;', 'read ,write, execute, delete');&lt;BR /&gt;&lt;BR /&gt;PL/SQL procedure successfully completed.&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; EXEC Dbms_Java.Grant_Permission('TEST', 'SYS:java.lang.RuntimePermission',&lt;BR /&gt;'writeFileDescriptor', '');&lt;BR /&gt;&lt;BR /&gt;PL/SQL procedure successfully completed.&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; EXEC Dbms_Java.Grant_Permission('TEST', 'SYS:java.lang.RuntimePermission',&lt;BR /&gt;'readFileDescriptor', '');&lt;BR /&gt;&lt;BR /&gt;PL/SQL procedure successfully completed.&lt;BR /&gt;&lt;BR /&gt;conn test/test&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt; create or replace and compile&lt;BR /&gt;  2     java source named "Util"&lt;BR /&gt;  3     as&lt;BR /&gt;  4     import java.io.*;&lt;BR /&gt;  5    import java.lang.*;&lt;BR /&gt;  6     public class Util extends Object&lt;BR /&gt;  7     {&lt;BR /&gt;  8      public static int RunThis(String args)&lt;BR /&gt;  9      {&lt;BR /&gt;10     Runtime rt = Runtime.getRuntime();&lt;BR /&gt;11     int        rc = -1;&lt;BR /&gt;12     try&lt;BR /&gt;13     {&lt;BR /&gt;14     Process p = rt.exec(args);&lt;BR /&gt;15     int bufSize = 4096;&lt;BR /&gt;16     BufferedInputStream bis =&lt;BR /&gt;17       new BufferedInputStream(p.getInputStream(), bufSize);&lt;BR /&gt;18       int len;&lt;BR /&gt;19       byte buffer[] = new byte[bufSize];&lt;BR /&gt;20      while ((len = bis.read(buffer, 0, bufSize)) != -1)&lt;BR /&gt;21           System.out.write(buffer, 0, len);&lt;BR /&gt;22         rc = p.waitFor();&lt;BR /&gt;23      }&lt;BR /&gt;24       catch (Exception e)&lt;BR /&gt;25       {&lt;BR /&gt;26          e.printStackTrace();&lt;BR /&gt;27          rc = -1;&lt;BR /&gt;28       }&lt;BR /&gt;29      finally&lt;BR /&gt;30      {&lt;BR /&gt;31          return rc;&lt;BR /&gt;32       }&lt;BR /&gt;33       }&lt;BR /&gt;34     }&lt;BR /&gt;35    /&lt;BR /&gt;&lt;BR /&gt;Java created.&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt;&lt;BR /&gt;SQL&amp;gt;&lt;BR /&gt;SQL&amp;gt; create or replace&lt;BR /&gt;  2  function RUN_CMD(p_cmd in varchar2) return number&lt;BR /&gt;  3     as&lt;BR /&gt;  4    language java&lt;BR /&gt;  5     name 'Util.RunThis(java.lang.String) return integer';&lt;BR /&gt;  6  /&lt;BR /&gt;&lt;BR /&gt;Function created.&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt;&lt;BR /&gt;SQL&amp;gt;&lt;BR /&gt;SQL&amp;gt; create or replace procedure RC(p_cmd in varchar2)&lt;BR /&gt;  2    as&lt;BR /&gt;  3      x number;&lt;BR /&gt;  4    begin&lt;BR /&gt;  5     x := run_cmd(p_cmd);&lt;BR /&gt;  6    end;&lt;BR /&gt;  7    /&lt;BR /&gt;&lt;BR /&gt;Procedure created.&lt;BR /&gt;&lt;BR /&gt;set serveroutput on&lt;BR /&gt;exec dbms_java.set_output(100000);&lt;BR /&gt;exec rc('show sys');&lt;BR /&gt;exec dbms_java.grant_permission( 'TEST', 'SYS:java.io.FilePermission', '&amp;lt;&lt;ALLFILES&gt;&amp;gt;', 'execute' )&lt;BR /&gt;at java.security.AccessControlContext.checkPermission(AccessControlContext.java:280)&lt;BR /&gt;at java.security.AccessController.checkPermission(AccessController.java:429)&lt;BR /&gt;at java.lang.SecurityManager.checkPermission(SecurityManager.java:528)&lt;BR /&gt;at oracle.aurora.rdbms.SecurityManagerImpl.checkPermission(SecurityManagerImpl.java:192)&lt;BR /&gt;at java.lang.SecurityManager.checkExec(SecurityManager.java:778)&lt;BR /&gt;at java.lang.Runtime.exec(Runtime.java:563)&lt;BR /&gt;at java.lang.Runtime.exec(Runtime.java:428)&lt;BR /&gt;at java.lang.Runtime.exec(Runtime.java:364)&lt;BR /&gt;at java.lang.Runtime.exec(Runtime.java:326)&lt;BR /&gt;at Util.RunThis(Util:11)&lt;BR /&gt;&lt;BR /&gt;PL/SQL procedure successfully completed.  &lt;BR /&gt;the procedure successfully completed,but the os command not be called,&lt;BR /&gt;thank you for help me!!!!&lt;/ALLFILES&gt;</description>
      <pubDate>Mon, 28 Apr 2008 04:37:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/java-procedure-call-os-command/m-p/4187576#M14575</guid>
      <dc:creator>ora_lion</dc:creator>
      <dc:date>2008-04-28T04:37:58Z</dc:date>
    </item>
    <item>
      <title>Re: java procedure call os command</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/java-procedure-call-os-command/m-p/4187577#M14576</link>
      <description>I am sorry, the java source named "Util" is for windows or linux,i used it under openvms,so the result was wrong,but i want to use it under openvms system,anyone can help me? thank you.</description>
      <pubDate>Mon, 28 Apr 2008 05:29:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/java-procedure-call-os-command/m-p/4187577#M14576</guid>
      <dc:creator>ora_lion</dc:creator>
      <dc:date>2008-04-28T05:29:17Z</dc:date>
    </item>
    <item>
      <title>Re: java procedure call os command</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/java-procedure-call-os-command/m-p/4187578#M14577</link>
      <description>It's not obvious (to me) what you are trying to do. I just want to point out what Java can execute: executable files.&lt;BR /&gt;&lt;BR /&gt;In a Unix environment these are programs and (shell/perl...) scripts. In a VMS environment these are images and DCL command procedures.&lt;BR /&gt;&lt;BR /&gt;You can not execute a Unix shell command or a VMS DCL command. For example, a VMS command "show sys" can not be executed from Java.&lt;BR /&gt;&lt;BR /&gt;Other examples are "ls -l *.txt" or "DIR/FULL *.TXT". Both will not work if run from Java for the same reasons: both require a shell or DCL to be activated.&lt;BR /&gt;&lt;BR /&gt;As a workaround, you may be able to run the command as a one-line input to the shell/DCL. On Unix this can be done with "sh -c \"ls -l *.txt\"". On VMS you may get it to work with the GNV DCL.EXE wrapper "gnu:[bin]dcl.exe \"DIR/FULL *.TXT\"".</description>
      <pubDate>Mon, 28 Apr 2008 07:12:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/java-procedure-call-os-command/m-p/4187578#M14577</guid>
      <dc:creator>x2084</dc:creator>
      <dc:date>2008-04-28T07:12:17Z</dc:date>
    </item>
    <item>
      <title>Re: java procedure call os command</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/java-procedure-call-os-command/m-p/4187579#M14578</link>
      <description>Is this your problem ?&lt;BR /&gt;&lt;A href="http://cs.felk.cvut.cz/vms/java142/user_guide.html#workingwruntimeexec" target="_blank"&gt;http://cs.felk.cvut.cz/vms/java142/user_guide.html#workingwruntimeexec&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Wim</description>
      <pubDate>Mon, 28 Apr 2008 14:47:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/java-procedure-call-os-command/m-p/4187579#M14578</guid>
      <dc:creator>Wim Van den Wyngaert</dc:creator>
      <dc:date>2008-04-28T14:47:08Z</dc:date>
    </item>
    <item>
      <title>Re: java procedure call os command</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/java-procedure-call-os-command/m-p/4187580#M14579</link>
      <description>my qustion is:&lt;BR /&gt;i want to execute openvms command such as $delete a.com;1 in plsql program&lt;BR /&gt;example:&lt;BR /&gt;SQL&amp;gt;exec exec_cmd('delete a.com')&lt;BR /&gt;&lt;BR /&gt;how can i do this?</description>
      <pubDate>Tue, 29 Apr 2008 13:34:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/java-procedure-call-os-command/m-p/4187580#M14579</guid>
      <dc:creator>ora_lion</dc:creator>
      <dc:date>2008-04-29T13:34:12Z</dc:date>
    </item>
    <item>
      <title>Re: java procedure call os command</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/java-procedure-call-os-command/m-p/4187581#M14580</link>
      <description>try "dcl.com delete a.com"&lt;BR /&gt;&lt;BR /&gt;and create dcl.com with&lt;BR /&gt;$ 'p1' 'p2' 'p3' 'p4' ...&lt;BR /&gt;&lt;BR /&gt;Check my link for "works".&lt;BR /&gt;&lt;BR /&gt;Wim</description>
      <pubDate>Tue, 29 Apr 2008 14:44:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/java-procedure-call-os-command/m-p/4187581#M14580</guid>
      <dc:creator>Wim Van den Wyngaert</dc:creator>
      <dc:date>2008-04-29T14:44:41Z</dc:date>
    </item>
    <item>
      <title>Re: java procedure call os command</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/java-procedure-call-os-command/m-p/4187582#M14581</link>
      <description>Wim Van den Wyngaert:&lt;BR /&gt;thank you,i had solved the problem</description>
      <pubDate>Thu, 01 May 2008 05:31:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/java-procedure-call-os-command/m-p/4187582#M14581</guid>
      <dc:creator>ora_lion</dc:creator>
      <dc:date>2008-05-01T05:31:44Z</dc:date>
    </item>
    <item>
      <title>Re: java procedure call os command</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/java-procedure-call-os-command/m-p/4187583#M14582</link>
      <description>1.&lt;BR /&gt;DCL.COM&lt;BR /&gt;$create/dir dkb0:[oracle.zm]&lt;BR /&gt;&lt;BR /&gt;SQL&amp;gt;exec rc('@dkb0:[oracle]dcl');&lt;BR /&gt;then the directory zm is created.&lt;BR /&gt;&lt;BR /&gt;2.&lt;BR /&gt;DCL.COM&lt;BR /&gt;$run $1$dga3:[USERS.LY]RMCOEFINIT&lt;BR /&gt;$@DCL  //the RMCOEFINIT.exe can be executed.&lt;BR /&gt;&lt;BR /&gt;but&lt;BR /&gt;SQL&amp;gt;exec rc('@dkb0:[oracle]dcl');&lt;BR /&gt;the RMCOEFINIT.exe can't be executed.&lt;BR /&gt;how can i execute the exe file.&lt;BR /&gt;</description>
      <pubDate>Fri, 09 May 2008 07:53:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/java-procedure-call-os-command/m-p/4187583#M14582</guid>
      <dc:creator>ora_lion</dc:creator>
      <dc:date>2008-05-09T07:53:11Z</dc:date>
    </item>
  </channel>
</rss>

