1 2 Previous Next 15 Replies Latest reply: Sep 2, 2013 8:57 AM by usman_noshahi RSS

    how to use cmd in host();

    usman_noshahi

      Hi ,

       

      i am using oracle forms and reports 10g.     10.2.0.1

       

      please give me example how to run this command form oracle forms using PL/SQL built in HOST();

       

      java -jar "D:\JAVAPROJ\PROJECT\dist\FILE.jar"

       

       

      It works fine with CMD directly but when i use host('cmd / c start java -jar "D:\SMS\SMS\dist\SMS.jar"');

       

      it give me error.

       

      example please..

       

      thanks

        • 1. Re: how to use cmd in host();
          InoL

          >It works fine with CMD directly

          On your PC I guess?

          HOST runs on the server, not on your PC. Use CLIENT_HOST if you want to run an OS command on your PC.

          • 2. Re: how to use cmd in host();
            Michael Ferrante-Oracle

            Something else to consider is that Forms 10 uses Java 1.4.2.  If you wrote your java code in anything newer and the java version being used in the one from the Oracle Home then your code might fail.  However, as mentioned above, if you are expected to run this on the client machine, you will need to use WebUtil (CLIENT_HOST).  Also, you said you were using Forms 10.2.0.  I'm going to guess and say that you probably meant 10.1.2.0.2 since there is no 10.2.  This might be important information later.

            • 3. Re: how to use cmd in host();
              usman_noshahi

              hello ,

               

              thanks for your reply.

              I am using.

              ------------------------------------------------------------------------------------------------------

              Forms [32 Bit] Version 10.1.2.0.2 (Production)

              Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

                   With the Partitioning, OLAP and Data Mining options

              Oracle Toolkit Version 10.1.2.0.2 (Production)

              PL/SQL Version 10.1.0.4.2 (Production)

              Oracle Procedure Builder V10.1.2.0.2 - Production

              --------------------------------------------------------------------------------------------------------

               

              I using 1.4 version for java program .

              i am configuring webUtil please give me syntax example how to use CLIENT_HOST properly to run .jar file

              thanks..

              • 4. Re: how to use cmd in host();
                CraigB

                usman_noshahi wrote:

                i am configuring webUtil please give me syntax example how to use CLIENT_HOST properly to run .jar file

                The syntax is the same, you just replace HOST with CLIENT_HOST.  For example:

                 

                Client_Host('cmd / c start java -jar "D:\SMS\SMS\dist\SMS.jar"');
                


                Just keep in mind that you must add all of the required WebUtil objects to your form in order to use Client_Host.  Refer to the WebUtil documentation or WebUtil Forms Help articles for how to use WebUtil.

                 

                Craig...

                • 5. Re: how to use cmd in host();
                  usman_noshahi

                  thanks CriagB

                  I configured webUtil perfectly , (though i have done it before)

                   

                  my java code is compiled at 1.3 version of JDK in Netbeans IDE.

                   

                  when codded this

                   

                   

                                       Client_Host('cmd / c start java -jar "D:\SMS\SMS\dist\SMS.jar"'); 

                   

                  at when button pressed trigger it shows me a black window with title :"C:\WINDOWS\SYSTEM32\cmd.exe

                   

                  remains open and does nothing...

                   

                  is there any thing which am i missing....

                   

                  thanks...

                  • 6. Re: how to use cmd in host();
                    CraigB

                    I recommend you create a batch file and call your Java program from the batch file.  Then call the batch file from Forms using Client_Host.  I've heard of their being problems calling Java directly via Client_Host as you are doing.

                     

                    Craig...

                    • 7. Re: how to use cmd in host();
                      usman_noshahi

                      thanks CriagB.

                       

                      before you posted i have just tried this way ,

                       

                      when i use same syntax in .bat file , when called from oracle forms it shows me in cmd black window

                      -----------------------------------------------------------------------------------------------

                      c:\devSuithome_1\forms>java jar "D:\SMS\SMS\dist\SMS.jar"

                      'java' is not recognized as an internal or external command,

                      operable program or batch file.

                      ----------------------------------------------------------------------------------------------

                       

                       

                      other wise .jar file is working very efficiently when i manually type the this " java -jar "file path.jar" "

                       

                      just one thing is left which calls that .bat file from oracle forms with right description ,

                       

                      i thing control should go on C:\ instead of c:\devSuithome_1\forms>

                       

                      please...

                       

                      thanks

                      • 8. Re: how to use cmd in host();
                        usman_noshahi

                        i tried all possible ways , calling .jar through .bat , and .jar directly from oracle forms via host(); and client_host();

                         

                        i am stuck...

                         

                         

                        please show me the way....

                         

                        thanks

                        • 9. Re: how to use cmd in host();
                          Andreas Weiden

                          Try to give the path to java.exe in your batch like

                          c:\Programs\java\java.exe

                          • 10. Re: how to use cmd in host();
                            usman_noshahi

                            if you means

                            c:\prgram\java\java.exe java -jar "D:\SMS\SMS\dist\SMS.jar"

                            if you means so then its not working too..

                            • 11. Re: how to use cmd in host();
                              Andreas Weiden

                              And what error does it show? Did you give the right path to java.exe?

                              • 12. Re: how to use cmd in host();
                                usman_noshahi

                                there is no error Sir,  console just opens and closes very quickly , there is no processing , and the java is installed in c:\program file\<java dir>

                                i made java.exe shortcut in c:\<maindirectory> because space creates problem in c:\program file\

                                • 13. Re: how to use cmd in host();
                                  François Degrelle

                                  You could try to redirect to a text file, maybe it will show you more information:

                                  c:\program\java\java.exe java -jar D:\SMS\SMS\dist\SMS.jar > D:\error.txt

                                  Francois

                                  • 14. Re: how to use cmd in host();
                                    Tharaka Uchiha

                                    Hi

                                    Try this

                                     

                                    begin

                                    HOST('D:\JAVAPROJ\PROJECT\dist\FILE.jar' );

                                    end;

                                    1 2 Previous Next