• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Running server java application from the web

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic