Unix script call from java applet

In perl you can use the system command to call a unix command like mv or ls. How do run a unix command from a java applet?

normaly java applets are not allowed to execute any code. But there is a possibility to ask the user to be allowed to..
in Netscpae you can use the following:
import netscape.security.PrivilegeManager;
then somewhere in the class...
PrivilegeManager.enablePrivilege( "UniversalExecAccess" );
then the user can press 'grant' or 'deni'. If he pressed grant, you can do the following:
Process process = Runtime.getRuntime().exec( "command" );
//where command is what ever command you like to execute
hope that helps.
lexip

Similar Messages

  • Unix SCRIPT CALL FROM PL/SQL

    How can I call an unix script from a PL procedure ?

    http://www.orafaq.com/scripts/c_src/extproc.txt

  • How to access system calls from java program?

    i am having a doubt regarding accessing system calls from a Java program like accessing unix system calls from a c program.

    Runtime.getRuntime().exec("line command here");
    example:
    Runtime.getRuntime().exec("ls -la");

  • Running a Unix Script through a Java Program

    Hi !!!!!!!!! Can anybody plz suggest me an approach for the following queries -
    1.  How to execute a unix script through a java program ?
      2.  How to send the o/p of the script to a java program so that it can be used .

    import java.io.*;
    public RunScript
       public static void main(String args[])
          try
              Process p = Runtime.getRuntime().exec("script.sh");
              BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));     
              while ((line = input.readLine()) != null)
                 System.out.println(line);
              input.close();
          catch(Exception e)
              e.printStackTrace();

  • Duration of an Abap Function call from Java using Jco3

    Hi guys!
    I would like to use this discussion to get some refernces of the duration Timespan of an RFC call from Java to SAP. At the moment, i need at last about 200ms to call the Abap function. I'm just using one simple import and export parameter (so no deep structures). I think that the reason for my poor performance is, that the Java Tool and the SAP instance are not in the same network. So, i hope some of you have some data, how fast an RFC call from Java using Jco can be executed.
    greetings, Hannes

    Hi Hannes,
    I think you have already got the answer to your question - the network set-up you have is probably the bottleneck.  Whenever I've worked with Java <-> ABAP and they are in the same network, I've had no performance problems at all.
    Does your RFC contain any complex logic or business processes?  Are you able to try and call something that does nothing, say it just accepts an input string and returns it straight away as an export.  Do you have any scope for testing with your Java tool on the same network as the SAP system?
    Cheers,
    G.

  • Photoshop scripting calls from Adobe Configurator panels

    Can javascritpt functions executing from an HTML element inside a panel affect the photoshop scene?  I know it can using the scripting toolkit, but I'm trying to do this in the Adobe Configurator.  In Configurator I created a new panel with an HTML panel and a button inside it that executes a javascript function on click "createDocument".  When I bring this into photoshop, I can load the panel and click on the button, but I never get a new document created.  If I uncomment the "alert" line, reexport the plugin, and click on the button, I get the alert, but still don't get a new document. 
    var createDocument = function() {
        app.documents.add(2,4);
        //alert("creating new doc!");
    I've tried other functions like creating layers, but still don't see anything happening in photoshop affecting the UI.  It's even more frustrating that I don't see any kind of error message that is happening.  My conclusions seem to imply this panel can't call the photoshop files for some reason (running in a different VM, wrong namespace, etc.).  Has anyone been able to make photoshop scripting calls from inside a configurator panel? 

    You might have better luck asking the in the Configurator forum. http://forums.adobe.com/community/labs/configurator/

  • Dll call from java using Jbuilder?

    Please?
    Does anyone know how I do dll calls from java (jubuilder).
    I have tried but did not manage to get it wright???
    / thanks carlos

    Research JNI (java native interface)

  • How can i measure BAPI runtime which has called from JAVA

    Hi abapers
    how can i get run time for BAPI called from JAVA through JCO.
    i know that i can use SE30 from ABAP by executing from SAP.
    may be ST05 useful for me i did it but when display trace
    i am getting big list by seeing this list i am not able to find the runtime for that BAPI.
    please any one can explain
    reagdrs
    ramesh

    Hi Ramesh,
       Irrespective of whether the call is from an external system or within sap, the bapi will be executed in R/3 only.
    So, you can safely measure the runtime using se30 only.
    If it is taking more time when called from JCo , then you can be sure that the problem is not with SAP and is actually due to the JCo connectivity with R/3.
    Regards,
    Ravi

  • Calling a WebService from Java Applet

    Hi all,
    In my application I have 3 projects:
    1. server - for all the business logic.
    2. view - for web app.
    3. swing - for applet.
    In the view project I wrote a WS, and I want to call it from my applet. So I created a WS using the Jdev (10.1.3.2) wizard in the view project (I tested it and it worked fine), and in the swing project I created a proxy for this WS, tested it and it worked fine. Then I created a JAR containing the swing project with the WS proxy classes, opened the Applet and find out that I have some classes missing, so I started adding all the relevant Jars and ended with a ~13MB JAR containing all the swing project jars that in the class path for a simple Applet.
    I know that I'm missing something but I dont know what. Do I really need all those Jars. Is there a simple way to call to a WS via Applet?
    This is the list of all the Jars:
    activation.jar
    commons-logging-api.jar
    commons-logging.jar
    ejb.jar
    http_client.jar
    jaxb-api.jar
    jaxb-impl.jar
    jaxen.jar
    jaxr-api.jar
    jaxrpc-api.jar
    jazncore.jar
    jdom.jar
    jms.jar
    jta.jar
    mail.jar
    mdds.jar
    oc4jclient.jar
    ojdl2.jar
    ojmisc.jar
    ojpse.jar
    oraclepki.jar
    orajaxr.jar
    orasaaj.jar
    orawsdl.jar
    orawsrm.jar
    osdt_cert.jar
    osdt_core.jar
    osdt_saml.jar
    osdt_wss.jar
    osdt_xmlsec.jar
    relaxngDatatype.jar
    saaj-api.jar
    saaj-impl.jar_old
    servlet.jar
    wsclient.jar
    wsdl.jar
    wssecurity.jar
    wsserver.jar
    xdb.jar
    xml.jar
    xmlparserv2.jar
    xsdlib.jar
    By the way at the end of all this annoying process I got the next exception:
    [failed to localize] typemapping.nested.exception.initialization(javax.xml.rpc.JAXRPCException: javax.xml.soap.SOAPException: Unable to create SOAP Factory: Provider com.sun.xml.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl not found)
         at oracle.j2ee.ws.client.BasicService.createLiteralMappings(BasicService.java:282)
         at oracle.j2ee.ws.client.BasicService.createStandardTypeMappingRegistry(BasicService.java:244)
         at com.tm.view.ws.misc.runtime.WSMisc_Service_SerializerRegistry.getRegistry(WSMisc_Service_SerializerRegistry.java:26)
         at com.tm.view.ws.misc.runtime.WSMisc_Service_Impl.<init>(WSMisc_Service_Impl.java:26)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
         at java.lang.reflect.Constructor.newInstance(Unknown Source)
         at java.lang.Class.newInstance0(Unknown Source)
         at java.lang.Class.newInstance(Unknown Source)
         at oracle.j2ee.ws.client.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:92)
         at oracle.j2ee.ws.client.ServiceFactoryImpl.loadService(ServiceFactoryImpl.java:121)
         at com.tm.view.ws.misc.WSMiscSoap12HttpPortClient.<init>(WSMiscSoap12HttpPortClient.java:20)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
         at java.lang.reflect.Constructor.newInstance(Unknown Source)
         at java.lang.Class.newInstance0(Unknown Source)
         at java.lang.Class.newInstance(Unknown Source)
         at client.base.connectivity.ClientRequestAgent.runWS(ClientRequestAgent.java:135)
         at client.base.connectivity.ClientRequestAgent.run(ClientRequestAgent.java:44)
         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
         at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Shachar

    Try this:
    1. open the webService data controll in the Data Controls section and drag the method from the webService onto the method call activity in your task flow. This will overwrite the current method property (the one which pints to your bean, make a copy of this entry if you can't reproduce it by hand). This too will create an entry in the pageDef of the method call activity.
    2. reenter (or paste) the original value in the method property, so that it again points to your bean. The entry in the pageDef will remain!
    3. now in the bean method you can access the method via its binding like you access any other method from the binding:
    // GET A METHOD FROM PAGEDEF AND EXECUTE IT
    // get the binding container
    BindingContainer bindings = BindingContext.getCurrent().getCurrentBindingsEntry();
    // get an Action or MethodAction
    OperationBinding method = bindings.getOperationBinding("YourMethodActionNAME");
    if (method == null)
    // handle method not found error...
    // if there are parameters to set...
    Map paramsMap = method.getParamsMap();
    paramsMap.put("param","value")  ;    
    // execute the method
    method.execute();
    List errors = method.getErrors();
    if (!errors.isEmpty())
       // handle errors here errors is a list of exceptions!
    // no error resume normal workTimo

  • Calling perl from java applets

    I have problems in executing PERL from a JAVA applet and Swing interface.
    I'm working under Windows 98.
    My aim is the following:
    When I click on the "Analizza" button,
    I want to execute a PERL program and automatically
    close the DOS window after completion. If there
    is an error, this error should be displayed in DOS.
    I wrote this piece of code
    public void actionPerformed(ActionEvent eventoUtente){
         String comandoPulsante = eventoUtente.getActionCommand();
              if (comandoPulsante == "Analizza"){
              Runtime rt = Runtime.getRuntime();
              try{
              Process pr= rt.exec("cmd -c c:\\command /c perl C:\\_webasco\\contatutto2.pl");
              catch(java.io.IOException ioEx)
              System.out.println("IOEx:"+ioEx.getMessage());
    I tried also with a Windows executable, ie I replaced the line
         Process pr= rt.exec("cmd -c c:\\command /c perl C:\\_webasco\\contatutto2.pl");
    with
         Process pr= rt.exec("command /c c:\\windows\notepad.exe");
    but in both cases nothing happens within the applet.
    What am I doing wrong????
    Any suggestions is warmly welcomed.
    Thank you
    Marina

    I know nothing about Perl, but the line
    if (comandoPulsante == "Analizza"){
    compares references not values and will always return false. Try:
    if (comandoPulsante.equals("Analizza")) {

  • IE6 leaks "Handles" when calling *ANY* Java applet

    Hello all IE experts,
    It seems that IE has "Handles" leak when it calls Java Applet.
    Every call to a Java method from JavaScript, IE allocate a handle and does
    not free it.
    THIS DOES NOT HAPPEN when I use mozilla or Netscape.
    Versions:
    * Windows 2000 SP 3 (The most recent, with all fixes of hfnetchk)
    * Internet Explorer (The most recent one, with all fixes of hfnetchk)
    Version 6.0.2800.1106
    SP1
    Q328970
    Q324929
    Q810847
    Q813951
    * Java Plug-in - 1.4.1_02-b06
    If you compile the applet and use the test html, then press "Test" you will
    notice that 1000 (or more) handles are allocated (At Windows Task Manager).
    If you press again you will see that another 1000 (or more) handles are
    allocated. The handles are NEVER released, even if you browse to other
    sites. You can enjoy this process until there are no more handles to
    allocate... :)
    Notice that the applet I use does nothing... I've checked this with various
    of applets on the web and the results are the same.
    Can anyone help?
    Best Regards,
    Alon Bar-Lev
    ** The following html is used: (test1.htm)
    <html>
    <head>
    <script LANGUAGE="JavaScript">
    function OnTest () {
    for (var i=0;i<1000;i++) { a1.method1 (); }
    </script>
    </head>
    <body>
    <input type=button onclick="OnTest ()" value="Test"></input>
    <APPLET code="test1.applet1.class" archive="test1.jar" id="a1" name="a1">No
    Java</APPLET>
    </body>
    </html>
    ** The following applet: (test1/applet1.java)
    package test1;
    import java.applet.*;
    public class applet1 extends Applet {
    public void method1 () {}
    ** The following makefile: (Makefile)
    JAVAC="$(J2SE)\bin\javac" -classpath $(CLASSPATH)
    JAR="$(J2SE)\bin\jar" -cvf
    CLASSPATH=.
    all:
    $(JAVAC) test1/*.java
    $(JAR) test1.jar test1/*.class

    New information:
    This happens from Java version 1.4.0_01.
    This did not happen in Java version 1.4.0.
    Alon.

  • Script Call from ADF

    Hi All,
    can we call unix Script (Bash script) from ADF?.
    Is there any option of doing it ?
    Regards,
    Suresh kumar.k

    you can create a bean for the ADF binding the button to the actionlistenr.. and call the script just as a normal java call..
    just look at this
    http://stackoverflow.com/questions/525212/how-to-run-unix-shell-script-from-java-code

  • Calling a Java Applet - Javascript

    Hey guys,
    I'm still fairly new to Java. I'm having a hard time getting my Applet to run properly.
    Basically, this is what I want it to do:
    I have a web page with a series of fields on it (a form). I have a submit button. When the user clicks the submit button, it activates a Javascript function in a seperate file that validates ALL of these fields. The validation that it does is merely to determine whether or not the fields are blank.
    Once it's accomplished this task, I THEN want it to run a Java applet.
    Everything works up until the point at which it runs the Java applet. I'm not sure how exactly I'm supposed to call the applet from Javascript.
    In every example of a web page that I see that has an applet, it has something that looks like this:
    <APPLET CODE="classname.class >
    </APPLET>That's all fine and good, but the problem is that it automatically calls the Applet then. I don't want it to do that. Is there a way that I can CALL the applet at the very end of a JS file? I mean, I don't want anything to load, no grey boxes or any of that stuff until I actually call it..
    Any idea?
    Thanks!
    Todd

    dude,
    have you managed to call an applet method from firefox?
    I'm not sure it is working at all.
    I've read few articles and everyone is complaining about the same error:
    Error: document.appl01 has no properties
    in the case above the applet was called "appl01"
    I've tried using
    document.applets[0].<the applet method>
    and I've got the same result..

  • UNIX "export" Command from Java

    Hi,
    Am facing a problem while exeuting UNIX command from java. Am attaching the code which I am trying to execute.
    import java.io.*;
    public class RunCommandExample {
        public static void main(String args[]) {
            String s = null;
            try
                Runtime.getRuntime().exec("password=midware1");
                   //p = Runtime.getRuntime().exec("export password");
                   System.exit(0);
              catch (IOException e)
                System.out.println("[IOException]. Printing Stack Trace");
                e.printStackTrace();
                System.exit(-1);
    }This gives me the following error.
    [IOException]. Printing Stack Trace
    java.io.IOException: password=midware1: not found
    at java.lang.UNIXProcess.forkAndExec(Native Method)
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:52)
    at java.lang.Runtime.execInternal(Native Method)
    at java.lang.Runtime.exec(Runtime.java:566)
    at java.lang.Runtime.exec(Runtime.java:428)
    at java.lang.Runtime.exec(Runtime.java:364)
    at java.lang.Runtime.exec(Runtime.java:326)
    at RunCommandExample.main(RunCommandExample.java:24)
    Please let me know the solution for this problem.
    Waiting for your valuable replay..
    Thanks in advance,
    Ashly.

    Assigning and exporting variables are not commands that you can execute from Java. You can only execute programs--binary executables. Assigning and exporting shell or environment variables is part of the shell.
    Why are you trying to do this? Even if you could, it wouldn't affect the running VM, and it wouldn't affect anything outside that exec() invocation.
    If you need to set them for something else you're going to run, then you should set them in a shell script and run that script.

  • Launching An Application From Java applet?

    is it possible to run an executable from a java applet (the executable could be in the local machine)? if it is not possible is there any other alternatives (like scripts)?

    Yes, it is possible but it violates the applet security rules. So you have to sign the applet for this to be allowed.

Maybe you are looking for