Permission denied when I execute a unix command from inside my Java applet.

Hi Gang,
Forgive me if I'm posting this to the wrong forum! I didn't get any answers on the previous forum that I posted this to.
I've written a simple java applet that runs a unix command and then displays some information. The applet compiles fine, and runs perfectly from the command line on my unix system.
However, when I point a browser at the applet from my desktop PC I get the following error as taken from the java console:
Exception in thread "AWT-EventQueue-2" java.security.AccessControlException: access denied (java.io.FilePermission <<ALL FILES>> execute)
This is of course the first line in a long line of error messages. It appears that I am not able to execute a command on the unix system through my applet. I know the problem is with trying to execute a unix command since commenting it causes no error in the web browser. This is the command I'm using in java to execute the unix command:
p = Runtime.getRuntime().exec("ps");
Here's the html file on the unix system:
<html>
<head></head>
<body>
<appletcode=G.class height="250" width="400">
Your browser does not support the applet tag.
</applet>
</body>
</html>
I won't list the java code since it is compiling and working on the command line. But, if you want to see it I'll provide it.
I've done quite a bit of research on this and it seems that a great number of people have similar problems reading or executing files through java. I have yet to find a solution to this problem.
Here are some details about my setup:
Server:
HP9000 running HP/UX 11.23
Apache Web Server 2.0.35
Java 1.5
Desktop PC:
Win2K Pro
Internet Explorer 6
Java 1.6
If you have a solution I would be very grateful! This problem is keeping me from writing my application!
thanks!
kev

Multi-posted.
Already answered here http://forum.java.sun.com/thread.jspa?threadID=5225314&messageID=9916327#9916327

Similar Messages

  • Permission denied when I execute a unix command from within my java applet.

    Hi Gang,
    Forgive me if this is not the appropriate forum for this problem. I'm posting this problem on this forum since I got no answers on the other forum I posted on.
    I've written a simple java applet that runs a unix command and then displays some information. The applet compiles fine, and runs perfectly from the command line on my unix system.
    However, when I point a browser at the applet from my desktop PC I get the following error as taken from the java console:
    Exception in thread "AWT-EventQueue-2" java.security.AccessControlException: access denied (java.io.FilePermission <<ALL FILES>> execute)
    This is of course the first line in a long line of error messages. It appears that I am not able to execute a command on the unix system through my applet. I know the problem is with trying to execute a unix command since commenting it causes no error in the web browser. This is the command I'm using in java to execute the unix command:
    p = Runtime.getRuntime().exec("ps");
    Here's the html file on the unix system:
    <html>
    <head></head>
    <body>
    <appletcode=G.class height="250" width="400">
    Your browser does not support the applet tag.
    </applet>
    </body>
    </html>
    I won't list the java code since it is compiling and working on the command line. But, if you want to see it I'll provide it.
    I've done quite a bit of research on this and it seems that a great number of people have similar problems reading or executing files through java. I have yet to find a solution to this problem.
    Here are some details about my setup:
    Server:
    HP9000 running HP/UX 11.23
    Apache Web Server 2.0.35
    Java 1.5
    Desktop PC:
    Win2K Pro
    Internet Explorer 6
    Java 1.6
    If you have a solution I would be very grateful! This problem is keeping me from writing my application!
    thanks!
    kev

    Multi-posted.
    Already answered here http://forum.java.sun.com/thread.jspa?threadID=5225314&messageID=9916327#9916327

  • Call Unix Command From Reports Using Java

    Hi,
    Could somebody please show me a sample coding to call Unix command from 10g report using java?
    In metalink doc id 361857.1 does not show much.
    Thanks,
    neemin

    Hi,
    I have a problem with synchronization of the java commands.
    In the Before Parammeter Form trigger, I have:
    function BeforePForm return boolean is
    rt ORA_JAVA.JOBJECT;
    proc ORA_JAVA.JOBJECT;
    v_txt varchar2(32000);
    i integer := 0;
    v_cd_modulo int;
    v_arqlog text_io.file_type;
    cursor c_evento is
    select codigo,
    nome
    from
    (select e.cd_evento || e.cd_edicao codigo
    ,nm_evento nome
    from grh_ev_evento e
    where e.CD_GRUPO in (select cd_grupo
    from grh_ev_adm
    where cd_usuario = (select cd_usuario
    from usuario
    where login_usuario = :AUTHID)))
    order by substr(nome, 11);
    begin
    -- Create the context for logged user
    if instr(upper(nvl(:AUTHID,'RWCLIENT')),'RWCLIENT') > 0 then
    :AUTHID := :SSO_USUARIO;
    end if ;
    TCEENV.SET_TCEENV(:AUTHID);
    if PK_SCA.SCA_GET_USER_RIGHTS(:sca_module_name, :AUTHID) IS NULL then
    srw.message(100, 'Access denided!');
    return (FALSE);
    end if;
    -- Create file in Report Server (UNIX)
    v_txt := '<BR>' || htf.formSelectOpen('P_EV_EDICAO', 'Evento: ');
    :p_file := '/u03/SCAWEB/repout/' || :sca_module_name || '_' ||
    pk_sca.sca_encrypt(:AUTHID || to_char(systimestamp, 'ss.ff'));
    v_arqlog := text_io.fopen (:p_file, 'A');
    text_io.put_line (v_arqlog, v_txt);
    for reg in c_evento loop
    i := i + 1;
    if i = 1 then
    v_txt := '<OPTION SELECTED VALUE="' || reg.codigo || '">' || reg.nome;
    else
    v_txt := '<OPTION VALUE="' || reg.codigo || '">' || reg.nome;
    end if;
    text_io.put_line (v_arqlog, v_txt);
    end loop;
    v_txt := '</SELECT></CENTER></form></BODY> </HTML>';
    text_io.put_line (v_arqlog, v_txt);
    text_io.fclose (v_arqlog);
    SRW.SET_AFTER_FORM_HTML(SRW.FILE_ESCAPE, :p_file);
    rt := RUNTIME.GetRuntime();
    proc := RUNTIME.exec(rt,'rm ' || :p_file);
    return (TRUE);
    end;
    The problem is that there isn't a "synchronize" command, and the
    RUNTIME.exec(rt,'rm ' || :p_file) don't works (it does nothing) because
    the SRW.SET_AFTER_FORM_HTML has a large delay and the following
    command is ignored.
    How can I solve it?
    thanks,
    lmprestes

  • How to execute linux sh command from inside CF

    I am using CFMX 7,0,0,91690 Enterprise on Redhat Enterprise Linux 4.9 with Apache webserver 2.0.52.  I have a coldfusion template that queries from a Postgresql 8.0 database, copies the data from the queries into a set of files in one folder on the linux server, and then has a CFEXECUTE tag at the very end that calls a bash shell script on the same server. The shell script takes the files from the one folder, merges some of their content together, moves them to another folder, adds header and footer, and sets ownership and permissions.  These 2 scripts have been in place and working perfectly for several years now. No changes were made to content, permissions, or ownershop of scripts.  Suddenly last Friday the coldfusion script seems to have lost its ability to execute the shell script properly.  It does execute it and the shell script attempts to do some of the steps, but the resulting files are missing the content and have the linux environmental variables and their values displayed instead.  Clearly its getting an error but that is not being reported back to me. After the CF script ends, if I manually execute the shell script from the linux command line, it works perfectly. I tried giving it more permissions but that did not help.  Redhat support suggests I run the script with "sh -x" to get more detailed output for debugging, but I would need to do that from inside the CF script since that is where the problem is.  Is it possible to execute a shell script from inside a CF script using a linux "sh" command in some way (instead of the cfexecute, just so I can see debugging info)? Thanks in advance for any suggestions. Julie

    Thanks for the suggestion, tried that too:
    <cfexecute name="/bin/sh" arguments="-x /bin/siscopy" outputfile="/home/coldfusion/sh_output.txt" timeout="600" />
    still didn't work.  Script ends with this coldfusion error:  Timeout period expired without completion of /bin/sh
    It does not complete the task of making the files, and the sh_output.txt file which is supposed to capture the -x output, is empty.
    Thanks,
    Julie

  • How can I execute a  .bat  file from inside a java application

    I have a .bat file which contains an executable file(.exe) and some input and output file names. What commands can I use to execute this bat file from my java application.

    After raeding tkleisas' reply; i am trying to invoke another application (which can be invoked from the command line) by using a batch file and trying Runtime.exec for executing a batch file.
    My current code is:
    Runtime runtime = Runtime.getRuntime();
    Process trialProcess;
    trialProcess = runtime.exec("cmd.exe /C start C:\\guns.bat /B");
    And my guns.bat looks like:
    cd C:\CALPUFF
    echo trial
    start calpuff.exe CALPUFF.INP
    This is not working for me and i get the following in the error stream of the trialProcess:
    Error :
    The system cannot execute the specified program.
    Process finished with exit code 1
    Has anyone come across something like this and know what's wrong with this one??
    thnx

  • How to execute unix command from ODI Procedure

    Hi,
    I am trying to execute below unix command from ODI Procedure (Command on Target tab) but I am getting the error "java.io.IOException: Cannot run program "cd": error=2, No such file or directory" but when I try to execute the same command using OdiOSCommand, it is executing successfully. I don't want to use shell script to execute this command. Is there any specific syntax am I missing to execute this command from ODI procedure?
    cd /project3/tmt/;ls *.dmp > dmplist.lst
    Please help me on this...
    Thanks
    MT

    Hi nahlikh,
    Thank you for the reply.
    I used below command in Procedure but still getting the same error as "java.io.IOException: Cannot run program "OdiOSCommand": error=2, No such file or directory".
    OdiOSCommand "-COMMAND=cd /project3/tmt/;ls *.dmp > dmplist.lst"
    as I mentioned earlier if I use the command cd /project3/tmt/;ls *.dmp > dmplist.lst in OdiOSCommand tool it is executing successfully without any issues.
    any thoughts appreciated to get a solution for this issue.
    Thanks
    MT

  • Execute unix commands from Java

    Hi,
    I have a client application running on windows. This client should connect to a unix server and check for the existence of a file and display the result as "File found/File not found". In order to connect from windows to the unix server, I used the sockets and the connection is successfully established. The second part is to check for the presence of the file in unix server. I searched in google.com and the option I found to execute a unix command from java is the "Runtime.exec()". Runtime.exec is considered as the less effective (not a favorable) one.
    Is there any other option available (other than the Runtime) to execute the unix command from java? Can you please let me know.
    Thanks a lot
    Aishu

    So, please let me know how I can execute the above unix commands without Runtime.exec()You have a client and a server.
    You want something to run on the server, not the client.
    That means that something must in fact being running on the server before the client does anything at all.
    For example telnet. Or a J2EE server application.
    So is something like that running?
    If not then there absolutely no way to do what you want, even with Runtime.exec().
    If yes then what you do depends on what is running. So Runtime.exec() would be pointless if a J2EE server was running.

  • Executing a bash command from Java

    I want to execute a bash command from within a Java application on the server. I know how to do simple commands, but this command is killing me. I get nothing back when I send it.
    p = Runtime.getRuntime().exec(new String[]{"ps","-ef","","grep","evolution"});
    There is also another part where I want the results piped to awk and fetch out the pids. BUt with this not working the rest is a waste for now.
    Robbie

    evgeni00 wrote:
    Thank you for assuming the posters' stupidity.I can only see the information that you provide. You didn't say you tried the recommendations.
    I read the article and I tried the things he/she is proposing, also the error stream, guess what it outputs: nothing.Maybe you did it wrong. If you didn't do it wrong, then that program you're invoking is poorly written, because it dies in error without producing any error messages.
    And I also searched for the exitValue 138, but didn't get much further than that its some system specific value. If you know where I can find more information, I would appreciate if you let me know about it. As jschell pointed out it's probably app specific. You can search the source code and/or documentation of that program to see if they say what 138 means.
    Apart from that -- it seems that environment and run directory issues can trip this up. Try checking that stuff out. Maybe your program expects something on the executable PATH that isn't there. Or maybe you're not running it in the working directory that you think you are.

  • How does one execute unix commands from within an applet?

    Greetings Folks,
    I've written a simple java applet that runs a unix command and then displays some information. The applet compiles fine, and runs perfectly from the command line on my unix system.
    However, when I point a browser at the applet from my desktop PC I get the following error as taken from the java console:
    Exception in thread "AWT-EventQueue-2" java.security.AccessControlException: access denied (java.io.FilePermission <<ALL FILES>> execute)
    This is of course the first line in a long line of error messages. It appears that I am not able to execute a command on the unix system through my applet. I know the problem is with trying to execute a unix command since commenting it causes no error in the web browser. This is the command I'm using in java to execute the unix command:
    p = Runtime.getRuntime().exec("ps");
    Here's the html file on the unix system:
    <html>
    <head></head>
    <body>
    <appletcode=G.class height="250" width="400">
    Your browser does not support the applet tag.
    </applet>
    </body>
    </html>
    I won't list the java code since it is compiling and working on the command line. But, if you want to see it I'll provide it.
    I've done quite a bit of research on this and it seems that a great number of people have similar problems reading or executing files through java. I have yet to find a solution to this problem.
    Here are some details about my setup:
    Server:
    HP9000 running HP/UX 11.23
    Apache Web Server 2.0.35
    Java 1.5
    Desktop PC:
    Win2K Pro
    Internet Explorer 6
    Java 1.6
    If you have a solution I would be very grateful! This problem is keeping me from writing my application!
    thanks!
    kev

    Multi-posted.
    Already answered here http://forum.java.sun.com/thread.jspa?threadID=5225314&messageID=9916327#9916327
    Please don't multipost again!

  • How to execute a Unix Command in java

    Hi, Iam trying to execute a unix command on Sun Solaris by passing that command to a java program. How can I achieve this?
    Thanks in advance.

    Have a look at the javadoc around the Runtime.exec() method. If the command is a shell command then you might have to execute a shell as well as the command.
    For example, if you wanted to run a unix command 'ls -l > output.txt' the you might have to pass the following string into the exec() method,
    "/bin/sh ls -l > output.txt'

  • Execute an Unix command with pipe

    Hi,
    How do I execute a unix command with pipe from JAVA runTime.exec(cmd)? for example: "ls -l |wc -l"
    should return number of files. However, there is no output result. If I use "ls -l" as command argument, it gives file list.
    Here is my program:
    public static void main(String[] args) {
    try {
    Runtime runCmd = Runtime.getRuntime();
    System.out.println("sys testing");
    Process retProc = runCmd.exec(args[0]);
    BufferedReader bread = new BufferedReader
    (new InputStreamReader(retProc.getInputStream()) );
    String out = bread.readLine();
    while ( out != null ) {
    System.out.println(out);
    out = bread.readLine();
    DataOutputStream outSt = new DataOutputStream(retProc.getOutputStream() );
    outSt.writeChars(args[1]);
    outSt.flush();
    } catch (Exception ie) {
    ie.printStackTrace();
    Thanks in advance,
    Jeff

    I got my answer !
    No need to reply

  • Permission Denied when calling a method from VB using WebLogic 8.1.2 JCOM

    Hi,
    We are calling an java/ejb methods from VB using WebLogic JCOM 8.1 SP2. But
    using JCOM, we are getting a error Permission denied when called from VB. We think
    that we should update pathch jintegra 2.0 or 2.1 in WebLogic 8.1.2 the to solve
    this issue, because we faced the same problen "permission denied" when we used
    JINTEGRA(third party software). Once we installed the JINTEGRA 2.1 it solved the
    issue.
    So, can anyone help on regard to this issue of "Permission denied" in WebLogic
    JCOM 8.1 SP2.
    Thanks & Regards
    Raghu

    I too am experiencing the jCOM error: "Run-time error '70': Permission Denied". The problem appears to be related to a Microsoft Security Patch KB835732 (MS04-011 which, as you indicated, has been fixed in J-Integra v2.1 (FYI, jCOM 8.1 is based on J-Integra 1.5.4, see J-Integra/jCOM versions.
    Did you ever get a resolution concerning 8.1 SP2? 8.1 SP3 is available now but I don't see any mention of jCOM updates in the WebLogic 8.1 What's New documention. I can't immediately upgrade (trying to stay on same version as a few other developers I work with) but I am hoping it is resolved in SP3.

  • Hi, I have Mac Book It currently at 10.6.8 I want know how to recover the FileVault Password? I tried /Library/Keychains/FileVaultMaster.keychain but it say permission denied when i'm the admin account

    Hi, I have Mac Book It currently at 10.6.8 I want know how to recover the FileVault Password? I tried /Library/Keychains/FileVaultMaster.keychain but it say permission denied when i'm the admin account

    Hi BobRz,
    As this is a new issue for me, I believe I had the incorrect approach, maybe you can help me. What I want to do is recover a few files in my desktop, and some information i had on the iCal application and the Mail application as well.As I do not want to do a full migration into this computer (which is not mine) I believe that starting the damaged MBP in Target mode should allow me to search and cop the files I need. But:
    1. Can I open the Ical and mail apps to look for the info I need while reading it as an external HD  ?
    2. Do the target machine (my friends) still need to be updated to ML o Mavs so that it recognizes my MBP as an external drive if starting it in Target mode ? (no migration assistant)
    Thanks.

  • Running Unix Command from WEB-APPLICATION

    Hi all,
    I want to run unix command from a java-based web application. the basic code part is this ---
    public class RunCommand
          public String runIt()
              String s = null, returnString = "";
              Process p=null;
              try
                       Runtime rt = Runtime.getRuntime();
                  p = rt.exec("sh testPOC.ksh");
                  p.waitFor();
                  BufferedReader stdInput = new BufferedReader(new
                       InputStreamReader(p.getInputStream()));
                  BufferedReader stdError = new BufferedReader(new
                       InputStreamReader(p.getErrorStream()));
                  // read the output from the command
                  returnString += "Here is the standard output of the command:<br>";
                  while ((s = stdInput.readLine()) != null) {
                      returnString += s;
                  // read any errors from the attempted command
                  returnString += "Here is the standard error of the command (if any): <br>";
                  while ((s = stdError.readLine()) != null) {
                      returnString += s;
              catch (IOException e)
                  returnString += "exception happened - here's what I know: ";
                  returnString += "error-> " + e.getMessage();
              catch(Exception e)
                returnString += "exception happened - here's what I know: ";
                  returnString += "error-> " + e.getMessage();
              return returnString;
      }this class is kept as an inner class. The control comes to its outer class, from servlet, from which the runit() is called. but the exception is occuring at line of p=rt.exec(.....). it tells "<command name> : not found transaction completed" [got this using getMessage() method].
    i am unable to show(and see, too) the stacktrace, because i don't have access to that test environment and its log. i can't run this in local because its windows one.
    now can anyone tell me, where is the problem. is there any limitation in web application server/container? this was successful when i used command prompt writing a .java file. Please help me. Thanks in advance...

    Friends, i've got, where the problem is.
    when we run a class file directly from a command prompt, we get an environment with that shell window. but for a servlet application running these kind of commands from a class creates kind of child processes. each and every command is executed as a child process of jvm and don't get those environment. we have 'PATH' variable in the environment. when a command (say, 'dir' or 'sh' or 'ls', etc.) is executed, the shell first search for that executable file (i.e. dir / sh / ls) in the given paths in the variable 'PATH'. this is not available for the child commands of jvm. hence the basic commands are searched in the current directory of the jvm and they are failed.
    i solved the problem giving full path of the commands. like :
    p = rt.exec("/bin/sh runningScript.ksh")

  • Running Unix Commands from SQLJ

    In straight JAVA I can execute a UNIX command like this
    String [] cmd = {"foo"} ;
    Process m ;
    m = Runtime.getRuntime().exec(cmd) ;
    When I do this in SQLJ I gen an exception raised.
    Is there a way around this?

    I assume you are trying to execute this Java code in a server-side stored procedure?
    I do not think that the server-side JavaVM allows you to execute Unix command lines. On the other hand, if you are trying to do this on the client, there should be nothing preventing you.

Maybe you are looking for

  • Stock Valuation - Inventory Management Cube

    Dear Sap Gurus, We have implemented the Inventory Management Cube in BW. Quantities are correct, but we have difference on the stock valuation. For some material stock value are correct, for some other they are not correct. A saw a lot of OSS notes a

  • My iWeb site can not be opened by many windows users only macs.

    My iWeb site should open for all platforms = How to do? I am also confused about compatability of my hard work and new iWeb sites (I love the iWeb App yet i got 4 family members all in different locations in the USA who run windows ....tell me that t

  • Can't drag files. Help!

    Hoping someone can help me. I came the other day to find that none of the files on our iMac G5 could be dragged. Stuff on the desktop couldn't be moved, re-arranged, etc. Even in iTunes, files couldn't be dragged to new playlists. I'm not sure what h

  • Check box to copy text from 1 field to another

    I am trying to use a check box to copy the tech from a billing address text box to a shipping address text box only if the check box is checked. I am new to using java and building forms in acrobat so please understand. I have googled and tried to im

  • Is there a program that replaced iDVD?

    I have some old iDVD files on a mac that doesn't have iDVD that I need to open is there anyway to do this?