• Post Reply Bookmark Topic Watch Topic
  • New Topic

Running server java application from the web  RSS feed

 
Aiglee Castillo
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

My situation is this: I have a php web page that has a form; I want the user to fill the form and press submit, so my web application can run a java application with the form inputs as arguments.

I want to run my java application like this: java Messages [arguments]

I read that I have to use CGIs to do this, but I don't know how. Do you know another way? Can you guide me how to do it with CGI?

Changing the java application is not an option


Thank you!
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you'd be better off asking this in a PHP forum, as it has nothing to do with Java. You need to figure out how to run an external process from PHP. This article looks highly relevant.
 
Aiglee Castillo
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not really, because I can execute those kind of things, the problem is with java because of the JVM, that is why I'm asking here
 
Joe Ess
Bartender
Posts: 9441
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So you can run other external processes but you are having trouble executing java? Perhaps you should give us some more detail on your problem. Are you receiving an error? What do your server logs say when you try to execute Java?
 
Aiglee Castillo
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for trying, I just found out the problems. I'll post the solutions here so anyone else looking for this can find it.

1) My server is a linux server and I was programming in my Windows computer, so I had to convert the files to Unix.
2) The cgi permissions has to be set to 755.
3) And the most important one, and the one that made me post here, was that if you are going to execute a java application in your cgi, you have to add your classpath in the cgi even if you have it right in the server:
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How's the performance on that? I guess it's just a feature of CGI that it starts up a new process for every request, but this time it's starting a JVM. That has to take a while, no?
 
Aiglee Castillo
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Right now is pretty fast, but I'm only running the java application with one number, and it has to work with a lot more. Right now I'm trying to call the cgi after some processing in the PHP web page, so I haven't test it with more than one request and more processing.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!