Discussion:
java like a CGI
(too old to reply)
Yoni
2013-04-11 20:48:30 UTC
Permalink
Hello,

I have a java program that I want to run in my cgi-bin directory.
My hosting plan does not support java.
If I can compile my java class into binary code (embedding a jvm) I should be able to use that program like a cgi.

Any suggestion? :)

I would like to avoid to translate that stuff in python or changing my hosting plan :-)

thank you!
markspace
2013-04-11 21:44:36 UTC
Permalink
Post by Yoni
Hello,
I have a java program that I want to run in my cgi-bin directory. My
hosting plan does not support java. If I can compile my java class
into binary code (embedding a jvm) I should be able to use that
program like a cgi.
Any suggestion? :)
Yes, get a hosting provider that supports Java. I don't think the
compiled-Java stuff works, strictly speaking.

Amazon EC2 instances work fine for Java, a full container like JBoss can
run easily on a micro instance. And micro instances are free for the
first year if you're a new customer.

I don't want to sound like an advert for Amazon EC2, but it's a decent
deal if you're just starting out.
Roedy Green
2013-04-12 01:17:40 UTC
Permalink
On Thu, 11 Apr 2013 14:44:36 -0700, markspace
Post by markspace
I don't want to sound like an advert for Amazon EC2, but it's a decent
deal if you're just starting out.
see http://mindprod.com/jgloss/ec2.html
for overview and links.
--
Roedy Green Canadian Mind Products http://mindprod.com
Computer programming is the best remedy for pain (physical or emotional)
I have encountered. It requires so much concentration there is nothing left
over to pay attention to the pain. They should teach this in AA.
Daniel Pitts
2013-04-11 22:34:42 UTC
Permalink
Post by Yoni
Hello,
I have a java program that I want to run in my cgi-bin directory.
My hosting plan does not support java.
If I can compile my java class into binary code (embedding a jvm) I should be able to use that program like a cgi.
Any suggestion? :)
I would like to avoid to translate that stuff in python or changing my hosting plan :-)
thank you!
Running Java as a CGI isn't a great idea in the first place. Most "web"
based Java programs are called "webapps", and they use "servlets". A
servlet is basically a java program which acts as a web server directly,
so the Java program doesn't need to "start up" every time a user request
comes in.
Lew
2013-04-11 23:59:22 UTC
Permalink
Post by Daniel Pitts
I have a java [sic] program that I want to run in my cgi-bin directory.
For God's sake, why?
Post by Daniel Pitts
My hosting plan does not support java [sic].
Switch hosting plans or use a different language than Java.
Post by Daniel Pitts
If I can compile my java [sic] class into binary code (embedding a jvm [sic])
I should be able to use that program like a cgi.
Any suggestion? :)
Don't.
Post by Daniel Pitts
I would like to avoid to translate that stuff in python or changing my hosting plan :-)
You want a lot of contradictory things.

Why don't you want to translate the code or change hosting plans?

Which is more work - banging together a Java program to use like it isn't Java,
or switching to a host that lets you use Java?

Over the long haul?

Really?
Post by Daniel Pitts
Running Java as a CGI isn't a great idea in the first place. Most "web"
Understatement.
Post by Daniel Pitts
based Java programs are called "webapps", and they use "servlets". A
servlet is basically a java [sic] program which acts as a web server directly,
Not exactly. It is a Java class that is invoked by the web server, itself a Java
program.
Post by Daniel Pitts
so the Java program doesn't need to "start up" every time a user request
comes in.
Step back and decide what you really want to accomplish. You don't want to
create a whole bunch of moreau hybrids whose components collide with
each other.

One assumes, given your question, that you don't expect to serve more than a
few dozen requests per minute.
--
Lew
Daniel Pitts
2013-04-12 16:55:42 UTC
Permalink
Post by Lew
Post by Daniel Pitts
I have a java [sic] program that I want to run in my cgi-bin directory.
For God's sake, why?
Post by Daniel Pitts
My hosting plan does not support java [sic].
Switch hosting plans or use a different language than Java.
Post by Daniel Pitts
If I can compile my java [sic] class into binary code (embedding a jvm [sic])
I should be able to use that program like a cgi.
Any suggestion? :)
Don't.
Post by Daniel Pitts
I would like to avoid to translate that stuff in python or changing my hosting plan :-)
You want a lot of contradictory things.
Why don't you want to translate the code or change hosting plans?
Which is more work - banging together a Java program to use like it isn't Java,
or switching to a host that lets you use Java?
Over the long haul?
Really?
Post by Daniel Pitts
Running Java as a CGI isn't a great idea in the first place. Most "web"
Understatement.
Post by Daniel Pitts
based Java programs are called "webapps", and they use "servlets". A
servlet is basically a java [sic] program which acts as a web server directly,
Not exactly. It is a Java class that is invoked by the web server, itself a Java
program.
Yes, though I didn't think that level of detail was useful for the OP.
Post by Lew
Post by Daniel Pitts
so the Java program doesn't need to "start up" every time a user request
comes in.
Step back and decide what you really want to accomplish.
Good advice.
Post by Lew
You don't want to
create a whole bunch of moreau hybrids whose components collide with
each other.
One assumes, given your question, that you don't expect to serve more than a
few dozen requests per minute.
Roedy Green
2013-04-12 00:37:03 UTC
Permalink
Post by Yoni
I have a java program that I want to run in my cgi-bin directory.
My hosting plan does not support java.
If I can compile my java class into binary code (embedding a jvm) I should be able to use that program like a cgi.
Any suggestion? :)
Find a new ISP or set up a little Linux server and host it yourself on
your home LAN. They will be even less happy about you running
arbitrary apps.

see http://mindprod.com/jgloss/ispvendors.html
--
Roedy Green Canadian Mind Products http://mindprod.com
Computer programming is the best remedy for pain (physical or emotional)
I have encountered. It requires so much concentration there is nothing left
over to pay attention to the pain. They should teach this in AA.
1connu
2013-04-12 16:24:08 UTC
Permalink
Post by Yoni
Hello,
I have a java program that I want to run in my cgi-bin directory.
My hosting plan does not support java.
If I can compile my java class into binary code (embedding a jvm) I should be able to use that program like a cgi.
Any suggestion? :)
I would like to avoid to translate that stuff in python or changing my hosting plan :-)
thank you!
You can try to use gwt (https://developers.google.com/web-toolkit/) to compile your original program into an equivalent javascript/html page
Loading...