Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

java like a CGI

23 views
Skip to first unread message

Yoni

unread,
Apr 11, 2013, 4:48:30 PM4/11/13
to
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

unread,
Apr 11, 2013, 5:44:36 PM4/11/13
to
On 4/11/2013 1:48 PM, Yoni wrote:
> 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.



Daniel Pitts

unread,
Apr 11, 2013, 6:34:42 PM4/11/13
to
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

unread,
Apr 11, 2013, 7:59:22 PM4/11/13
to
Daniel Pitts wrote:
> Yoni wrote:
>> I have a java [sic] program that I want to run in my cgi-bin directory.

For God's sake, why?

>> My hosting plan does not support java [sic].

Switch hosting plans or use a different language than Java.

>> 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.

>> 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?

> Running Java as a CGI isn't a great idea in the first place. Most "web"

Understatement.

> 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.

> 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

Roedy Green

unread,
Apr 11, 2013, 8:37:03 PM4/11/13
to
On Thu, 11 Apr 2013 13:48:30 -0700 (PDT), Yoni <a.sfo...@gmail.com>
wrote, quoted or indirectly quoted someone who said :

>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.

Roedy Green

unread,
Apr 11, 2013, 9:17:40 PM4/11/13
to
On Thu, 11 Apr 2013 14:44:36 -0700, markspace
<mark...@nospam.nospam> wrote, quoted or indirectly quoted someone
who said :

>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.

1connu

unread,
Apr 12, 2013, 12:24:08 PM4/12/13
to
Yoni a �crit :
You can try to use gwt (https://developers.google.com/web-toolkit/) to compile your original program into an equivalent javascript/html page

Daniel Pitts

unread,
Apr 12, 2013, 12:55:42 PM4/12/13
to
On 4/11/13 4:59 PM, Lew wrote:
> Daniel Pitts wrote:
>> Yoni wrote:
>>> I have a java [sic] program that I want to run in my cgi-bin directory.
>
> For God's sake, why?
>
>>> My hosting plan does not support java [sic].
>
> Switch hosting plans or use a different language than Java.
>
>>> 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.
>
>>> 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?
>
>> Running Java as a CGI isn't a great idea in the first place. Most "web"
>
> Understatement.
>
>> 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.
>
>> 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.
0 new messages