Executing an Executable or Batch file in DOS/Unix Env. - Urgent Urgent.

Hi there
We are currently using Oracle 8i with 9ias as the Application Server. I have a requirement where I should be executing a batch file or a executable on the local client system (from where the browser runs).
I have downloaded a script from Oracle Metalink which creates a class file. This class file enables me to create a executable or a batch file on to the local client machine. But does not allow me to execute it.
Can anyone kindly send me a script which enables me to execute a .exe file on the client machine.
Many thanks in advance.
Regards
Pavan Chelvaraj

I have the below program. I need to embedd, the script for executing a file. Please help.
Regards
Pavan Chelvaraj
import oracle.forms.ui.*;
import oracle.forms.properties.ID;
import oracle.ewt.lwAWT.lwText.*;
import java.awt.*;
import java.io.*;
public class TextPJC extends VTextArea {
private static final ID READFILE = ID.registerProperty("readfile");
private static final ID WRITEFILE = ID.registerProperty("writefile");
private String filename=null;
public TextPJC() {
super();
public boolean setProperty(ID pid, Object value)
if(pid ==READFILE) {
try {
File inputFile = new File((String)value);
FileReader in = new FileReader(inputFile);
char c[] = new char[(int)inputFile.length()];
char c1[]= new char[(int)inputFile.length()];
in.read(c);
int j=0;
for (int i=0;i<inputFile.length();i++)
if((int)c==13);
else
c1[j++]=c[i];
String str = String.copyValueOf(c1,0,j);
this.setContent(new LWTextArea(str));
in.close();
catch(Exception e) {System.out.println("Error in PJC " );e.printStackTrace();}
return true;
else if(pid==WRITEFILE) {
try {
File inputFile = new File((String)value);
FileWriter in = new FileWriter(inputFile);
LWTextArea lw = (LWTextArea)(this.getContent());
String text1 = lw.getText();
int length1 = text1.length();
char c[] = new char[(int)length1];
char c1[]= new char[(int)length1*2];
text1.getChars(0,length1,c,0);
int j=0;
String s1= System.getProperty("line.separator");
for(int i=0;i<length1;i++)
if ((int)c[i]==10)
s1.getChars(0,s1.length(),c1,j);
j=j+s1.length();
else
c1[j++]=c[i];
in.write(c1,0,j);
in.flush();
in.close();
catch(Exception e) {System.out.println("Error " );e.printStackTrace();}
return true;
else
return super.setProperty(pid,value);

Similar Messages

  • Java.io.filepermission error while executing a batch file from java prog

    Hi,
    i want run a java program which executes a batch file, both are in a jar file. while am trying this using webstart it shows error:access denied java.io.filepermission <<ALL FILES>>execute. why this happens how to rectify this.
    By
    Vinod

    Clearly, it would be a security vulnerability to be able to do such a thing from the web w/o user granting trust to the application.
    Java Web Start applications run in the Java SE secure sandbox unless they have been granted all-permissions by the user:
    1.) sign all jar files.
    2.) add <security><all-permissions/></security> to the jnlp file.
    The user would then be prompted to grant trust to the applications.
    /Andy

  • Urgent : Executing a batch file in a JSP file

    Hi;
    I need help in executing a batch file within a jsp page, ive the following codes but it doesnt seem to work...
    These are the codes :
    <%@ page import="java.util.*,java.io.*,java.net.*" %>
    <%@ page import="java.sql.*" %>
    <%
    Process p = Runtime.getRuntime().exec("Ratio.bat");
    p.waitFor();
    int i = p.exitValue();
    %>
    The following is the error :
    ype Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    java.io.IOException: CreateProcess: Ratio.bat error=2
    java.lang.Win32Process.create(Native Method)
    java.lang.Win32Process.<init>(Win32Process.java:63)
    java.lang.Runtime.execInternal(Native Method)
    java.lang.Runtime.exec(Runtime.java:550)
    java.lang.Runtime.exec(Runtime.java:416)
    java.lang.Runtime.exec(Runtime.java:358)
    java.lang.Runtime.exec(Runtime.java:322)
    org.apache.jsp.invRatio_jsp._jspService(invRatio_jsp.java:52)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    Anyone can tell me why it doesnt work ?... Thanks

    Aside from removing the "start" or adding the title ...
    Does your batfile really say "SET PATH=%PATH%;%JAVA_HMOE%\bin"? If so, I rather expect you meant to say "JAVA_HOME" and not "JAVA_HMOE".
    Also, I'd be cautious about those relative paths that you're passing in to the Java program. Of course I don't know what you're doing with those in the program, but if you try to just pass those paths to a File or InputStream constructor, they're going to be relative to the current directory. And if you execute a batfile using cmd from an exec that's within a JSP ... I'm not sure what your current directory would be when the bat runs. Maybe you've checked this out and it's the right place, but if not, perhaps you have a misconception there.

  • How to execute a batch file on different remote server using TFS Build

    I have a build server and have 2 web servers. I am deploying using TFS Builds. Now, I have a requirement to execute a batch file which is kept on these 2 web servers. i.e. C:\MyBatch\CreateMe.bat
    After my build is successful, I need to execute this batch from the build server.
    Note, I cannot make any shared folder.

    Hi Sameer, 
    Thanks for your post.
    What’s the version of your TFS?
    How do you deploy solution using TFS Build, run MSBuild deploy command or using Release Management?
    That C:\MyBatch\CreateMe.bat file stay on your two web server machines separately? 
    If you want execute this bat file on your two web server machines separately using build process template, you need configure your web server machine as build agent, then add the InvokeProcess activity in build process template to run the bat file on build
    agent machine after build, please refer to Hari’s answer reply in this post:
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/b8bcb19f-1296-441c-8356-e701b949445a/tfs-2010-how-to-execute-a-batch-file-after-build?forum=tfsbuild.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to execute java batch file in JSP

    Kindly give a solution. I want execute a batch file which gives a preview window ,. I want call that batch file in my jsp, .I am using Tomcat 5.5, I have tried that using a Process object and Runtime.getRuntime().exec(path) , where path is location of my batch file. As a java class i could execute the batch file, but when i import the method in JSP nothing is happening (even no jsp error).
    Is it possible to execute the batch file in JSP?
    Can any one help me?

    itsdhanasaraa wrote:
    But as this a web application ... By using Runtime i'm getting some probs ..
    Let me guess, you want your web application to run a program on the client and to your surprise that's not working?
    Ain't gonna happen.
    its taking more time to execute .... that's y is there any other option to execute .exe file other than Runtime.getRuntime().exec("filename");Write proper English and you may be taken more seriously.
    1) it's not "taking more time to execute", whatever that's supposed to mean.
    2) there's no other way to execute something. Not that you should every use even that way anyway
    3) whenever you start thinking of executing external programs from Java, start thinking of not using Java in the first place.

  • Execute a Batch file

    Hi,
    I need help in writing a method that execute a batch file which is in a different directory from my java application and show the result(after executing the batch file) in the java application. Can anyone tell me how to do that?
    Thanks,
    Khim

    Hi,
    Below are the codes in my application. Using these codes, the batch file can execute but I cannot get the output of the result from the batch file. (if I run the batch file from cmd, it shows: "Error: 0 : Cannot authenicate the information after all the attempts")
    String cmd = new String();
    Runtime rt = Runtime.getRuntime();
    System.out.println("Executing VocaliD check..");
    cmd="C:\\JNI\\Elva\\debug\\plug.bat";
    Runtime rn = Runtime.getRuntime();
    Process pc1 = rn.exec(cmd);
    String result=new String(pc1.getInputStream().toString ());
    System.out.println(result);
    The result I got is below:
    Executing VocaliD check..
    java.io.BufferedInputStream@3179c3
    Thanks,
    Khim

  • Executing a batch file from a jsp

    hi,
    i have a jsp running on tomcat 3.1
    now upon submit, i want a batch file to execute .
    how do i do that..( i mean what will be the correct syntax for this ) say the batch file exists in /tomcat/batch/ do i have to give the abosolute path for this or a relative path will do.. ( if the relative path works then, do i have to mention a context for the batch directory in server.xml..
    pls help.. this is urgent
    thanx

    Hi truptip,
    This is the code to execute a batch file or any system command,
    Process p = Runtime.getRuntime().exec("shell command you want to exit");
    p.waitFor();
    In regards to whether you should access it using a relative location, the answer is no. Execution of a batch file is not part of the the webserver, so the webserver's concept of the current directory for the client does not apply.
    On a side note I wanted to say that I would highly recommend that you don't put the batch files anywhere on the webserver that is accessible to the user, not that the webserver would execute the code, but it may let out some information that you don't want available.
    Hope this is of some help,
    James

  • Running executable in batch file as administrator when UAC is high

    Hi Team,
    I have a requirement of running executable in batch file by passing the current windows login username as parameters. Below is the content of my batch file:
    cmd /c start setup.exe http://testsite:7001/mobile  %username%  %username%
    But, when the UAC is set high in windows 7 machine, this executable is not running properly, and giving me warnings. And, if I am running the same start command after opening command prompt as administrator, then executable is running smoothly.
    So, is there any way I can run the executable as administrator by giving some options in batch file, when UAC is high?
    I tried runas option, but its prompting for admin password, which we can't provide as users will not know.
    Do we have some option in batch file as 'Run As Administrator' right click option, where it doesn't prompt for password but run the file with admin privilege?
    Thanks,
    Tina Soni

    Hi,
    When using Runas command, you can add a switch option /savecred
    /savecred will make it ask for admin password on the first run only, after that it should be saved
    Yolanda Zhu
    TechNet Community Support

  • Executing a batch file (.bat) on a different PC

    Hi,
    Is it possible to execute a batch file on a different pc.
    Look at the following piece of code.
    import java.io.*;
    public class StartRemoteCmd {
         public static void main(String[] args) throws IOException
              System.out.println("Starting remote Command");
    Process p = Runtime.getRuntime().exec("\\\\Itop001\\Tomcat\\commons-net-1.0.0\\setclasspath.bat");
              if (p==null){
              System.out.println("Process is null");
              System.exit(1);
              System.out.println("Started remote Command");
    The machine ITOP001 has this setclasspath.bat...which sets classpath and has a java CustPgm.
    I want to start this CustPgm program on ITOp001 from my machine.
    Is it possible..? Am I doing some mistake in the code..pls suggest.
    Thanks guys

    Can't really add much to the online help:
    The AT command schedules commands and programs to run on a computer at
    a specified time and date. The Schedule service must be running to use
    the AT command.
    AT [\\computername] [ [id] [/DELETE] | /DELETE [/YES]]
    AT [\\computername] time [/INTERACTIVE]
        [ /EVERY:date[,...] | /NEXT:date[,...]] "command"
    \\computername     Specifies a remote computer. Commands are scheduled on the
                       local computer if this parameter is omitted.
    id                 Is an identification number assigned to a scheduled
                       command.
    /delete            Cancels a scheduled command. If id is omitted, all the
                       scheduled commands on the computer are canceled.
    /yes               Used with cancel all jobs command when no further
                       confirmation is desired.
    time               Specifies the time when command is to run.
    /interactive       Allows the job to interact with the desktop of the user
                       who is logged on at the time the job runs.
    /every:date[,...]  Runs the command on each specified day(s) of the week or
                       month. If date is omitted, the current day of the month
                       is assumed.
    /next:date[,...]   Runs the specified command on the next occurrence of the
                       day (for example, next Thursday).  If date is omitted, the
                       current day of the month is assumed.
    "command"          Is the Windows NT command, or batch program to be run.

  • HOW to run a batch file in DOS 6.22???

    I have written a batch file that runs fine under Windows Command Prompt, but I would like to be able to run it after POST in DOS. I have copied my code to AUTOEXEC.BAT file which gets executed automatically; however it comes up with syntax errors
    once it reaches the call command and the rest.
    echo. This script is counting the # of POSTs.
    echo. The POST # value is saved in TEST.txt.
    echo.
    call:myPOSTTest
    for /f "tokens=* delims=" %%x in (A:\TEST.txt) do echo POST# %%x
    echo. &pause&goto:eof
    ::-- Function section starts below here
    :myPOSTTest - here starts my function identified by its label
    set var=0
    if EXIST A:\TEST.txt (
    for /f %%x in (A:\TEST.txt) do (set /a var=%%x+1)
    echo %var% >> A:\TEST.txt
    goto END
    :END
    Thank You

    Call is used to execute another batch file external to the one your in, you can only call a label if the command extensions are enabled.
    http://www.computerhope.com/call.htm
    Since you are not passing any parameters into :myPOSTTest you might just be able to use GOTO instead.

  • DOS Window automaticly close after execute the batch file and start the App

    Hi, all. I have made a batch file. When I start the batch file, thet is getting open the DOS Window. But I want close the DOS Window after Start the Application, or make it hidden?
    It is possible?
    Thanks all:-)
    Nikolay

    Hi,my batch file is:
    java -cp File.jar Desktop
    I have tryaed with:
    javaw -cp File.jar Desktop , but it dosn�t close the DOS Window.
    Have I make anythink false?
    Thanks.
    Nikolay

  • How can I execute a batch file from my java program

    Hi,
    Can someone help me or direct me to a link,
    How can I execute a DOS batch file from my java program?
    Thanks

    You will need to grab a handle to the process's
    outputstream so u can see its output.The OP didn't mention any output from any batch file;
    nor any input for that
    matter,so lets not complicate matters here for now
    ok?Actually I think this is essential to see whether it works or not. It's either that or do some manual check to see whether it ran, which is not exactly elegant, and in some cases this may not be easier than simply writing the output stream code, or in fact it may be impossible to check manually.
    I'm sure it wasn't intentional that your post appeared to be bristling with attitude.

  • How to execute  a batch file using javascript

    Hi,
    I dont know java. i have a batch file to do my task. Im designing the front end with HTML.Can anyone tell the command to execute batchfile using javascript
    Message was edited by:
    viswanath_java

    Java and not JavaScript are not the same thing or even close to the same thing. You appear to be in way over your head. It might be a good time to fess up to your employer that you are underqualified.
    Apart from the JavaScript faux pas your question is also lacking because
    - you don't identify what this batch file is or does or needs to execute in
    - it is very difficult to understand how the front end for this will be HTML
    It seems you may one day want something like a Servlet. But you are long way from implementing this solution.

  • Execute a batch file on a remote PC

    Hello,
    I have a powershell script that I would like to exceute several batch commands on a remote computer.  I first need the script to change to the network drive on that remote computer then execute a batch command that I write into the script is that
    possible?
    G

    I did try it and no results were giving and the jvm services on the remote machine was not stopped.  Here is what im trying to do based on your suggestions.
    $process
    =
    [WMICLASS]"\\severgoeshere\ROOT\CIMV2:win32_process"
    $result
    =
    $process.Create("e:\stopserver.bat
    JVMdfs -user <myusername> -password <mypassword> ")

  • Executing a batch file from oracle

    Hi ,
    I just want to execute a windows .BAT file using a .SQL script from a Unix server.
    please guide me

    And I just want world peace, but I think that both of us are going to be disappointed.
    Taking Oracle and SQL out of the equation for a minute, are you able to execute a Windows .BAT file on a Unix server?
    This may not be as silly as it sounds, because using cygwin, I am able to execute Unix scripts on Windows, though why anyone would port Windows command line (in) capabilities to Unix is beyond me.

Maybe you are looking for