3

Hi, there is a Java program edited and compiled using Netbeans 6.9.1. After running it's giving proper output in Netbeans output screen. But now I need to run this program in WAMP server. WAMP supports only scripting languages.

I can not run the Java program which I have already built. If I try to run in Tomcat I won't get war file to deploy. Should I use servlets? If so, how can I use it in Netbeans Java applications? Or should I convert (rewrite) Java program to PHP program, if so, how to convert? How do I run the Java program in WAMP or Tomcat?

Michaël
  • 3,679
  • 7
  • 39
  • 64
user1074824
  • 73
  • 2
  • 2
  • 7

3 Answers3

1

If your program writes to standard output, then you should be able to use CGI in some way.

Here are some (admittedly old) links on the topic:

http://www.javaworld.com/javaworld/jw-01-1997/jw-01-cgiscripts.html

http://www.gossamer-threads.com/lists/apache/users/184459

They should at least point in the right direction.

Vlad
  • 18,195
  • 4
  • 41
  • 71
0

It looks like you've created a regular Java program because it outputs to the NetBeans console output.

You can't install a regular Java application to a web platform like that. You need to wrap it in a JavaServer Pages (JSP) application, Servlet or Applet to be able to run it on a web server. After that, install Tomcat or GlassFish as an application server to be able to access it on localhost (both are also optionally available from NetBeans, they can be found in the Plugins menu).

A good resource to start is this tutorial on JSP: http://java.sun.com/developer/onlineTraining/JSPIntro/contents.html

WAMP won't be of any help, it can only serve as a host for PHP content.

Léon Rodenburg
  • 4,894
  • 1
  • 18
  • 18
0

You have multiple options for running your java program:

  1. Convert your program to a library and then integrate it with PHP
  2. Package your application as a Java Web App.

In either case you should definitely have an idea of jsp, servlet read here

Community
  • 1
  • 1
mprabhat
  • 20,107
  • 7
  • 46
  • 63