views:

67

answers:

5

I have an application on my server that is called leaf.exe, that haves two arguments needed to run, they are: inputfile and outputfile, that will be like this example:

pnote.exe input.pnt output.txt

They are all on the same directory as my home page file(the executable and the input file). But I need that a JavaScript could run the application like that, then I want to know how could I do this.

I'm using just Apache, I don't have any language for web installed on it. My goal is to do a site using just JavaScript, without the help of anyother language than it, HTML and CSS.

+2  A: 

You would need to make an Ajax request to the server - the server would then have a handler that would then invoke the executable with the appropriate parameters.

Without know which web server technology you are using, it's harder to give a more concrete answer (ex: ASP.NET, PHP, Ruby, etc).

EDIT: If you're talking about doing this without any kind of server side resources, then this is impossible, and for good reason. Think of the security exploits!

Tejs
Now I don't matter with security, I just want to do it.
Nathan Campos
+1  A: 

JavaScript is for Client Side of a web application, so you won't be able to directly use javaScript to access server side files. As mentioned by Tejs, you should use Ajax to make a call to server side and then use appropriate server side routine to do the task.

Even at client side, most browsers don't allow accessing of any resource( e.g files) by javaScript code.

Gunner
Any other way to this without using other languages that need to be installed on the server?
Nathan Campos
Guys, you can run javascript on the server. Look at Rhino and node.js
James Westgate
Javascript can be used server side and you can access files server side with it. I have programmed complete web applications using only javascript (client and server side).
KooiInc
+2  A: 

Any other way to this without using other languages that need to be installed on the server?

No, but you almost certainly already have languages on the server. If it's a Linux, BSD or OSX server you've got shell script; if it's a Windows server you've got JScript and VBScript via Windows Scripting Host (using a cscript.exe hashbang).

bobince
A: 

Look into Rhino and node.js. I dont know a lot about this, but thats a route you can use for serverside javascript.

James Westgate
+1  A: 

For server side javascript in Apache you could use Sun ONE Active Server Pages, formerly known as Chili!Soft ASP. For an IIS server, javascript is plainly available as asp-language.

KooiInc