1

I want to execute a maven command (mvn test) from javascript code but it doesn't work here's the code of my Servlet ;

 out.println("<script type='text/javascript'> " +
      "function f(){ try{var wsh = new ActiveXObject('WScript.Shell'); " +
      "wsh.Run('cd C:/Users/Amira/junoWorkspace/TestProjectUI');" +
      "wsh.Run('mvn -Dtest=MyClassTest test') } catch(err){} } </script> "); 

 out.println("<body><input type='submit' value='Execute Test' onclick='f()'>  </body>");

So any idea please if there's a better solution please mention it Cheers

0

1 Answer 1

3

You can't do that.
Ever​​​​​​.

Sign up to request clarification or add additional context in comments.

4 Comments

Forever ever? Forever ever. :P
@SLaks can i do it with java? do you have any other solution
@AmiraManai: You will never be able to execute commands on the client machine.
Uhm, it may be possible with ActiveX. In IE, that is.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.