PHP/Java Eclipse - java

I've created a Java project in Eclipse that holds applet with Java perspective and another PHP project with PHP perspective that holds file that has javascript to communicate with the java applet.
Unfortunately I don't know how to setup the Java files into the PHP project so that the applet works from my localhost.
I had the applet somewhat working when I put the PHP files into Java project and ran it like that but I need it other way so that I can run from my PHP project.Anything is great. Thanks

Keep your Java and PHP projects completely separate. Keep in mind that you can serve up your Java applet in any number of ways, your PHP implementation is just one. With that knowledge in hand what you really want to do is to decide where your Applet bundle is going to live. I recommend you create a simple HTML file on your server and test loading the applet from whatever location you decide on. Then in your PHP file just write code to spit out the exact same HTML to the client.

put the PHP files into Java project ... wrong way!
Try using another tool to edit your PHP scripts. Setup XAMPP server for development environment.

Related

Java/JSP : Making a executable Java working as webapp

I have a standard java project working local made by another person i know.
It's about data retrieving.
I need to develop a web app supposed to do the same thing but accessible by anyone via browser.
I CAN'T edit the code for that purpose, at least some implementation details. A kind of black box.
Can you suggest me the best approach to make a webapp based on a local executable app through JSP & servlet ecc?
Maybe you can try something like webswing.
What is Webswing ? Webswing is a web server that allows to run any swing application inside your web browser using only pure HTML5.
The best days of swing framework are gone. Desktop applications lost
popularity and everything is forced to be online and mobile. But what
about existing application? Using applet technology proved to be
insecure, rewriting the application to web technology is too
expensive. This is where Webswing can help you. With Webswing, your
application is securely running on server and user's browser only
displays the application window. All this without changing single line
of source code.

Execution of Java programs in WAMP

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?
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.
You have multiple options for running your java program:
Convert your program to a library and then integrate it with PHP
Package your application as a Java Web App.
In either case you should definitely have an idea of jsp, servlet read here
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.

Starting web programming in Java

I've been programming in PHP and ASP.NET for a while now. When doing PHP, I've always used XAMPP to test my websites. I'm wondering (since I'm learning Java) if there are equivalent services around?
Furthermore, I know this is sort of an open question, but how would you make a basic page in Java, just a basic 'Hello World' web page.
You can actually still use XAMPP. You just need to install tomcat. Here is a great screen cast on how to do it: http://www.youtube.com/watch?v=TUV_jPdq7fc.
If your a mac user you can try MAMP (whcih I prefer) and follow http://blog.mirotin.net/22/tomcat-on-mamp-the-simple-way. To get Tomcat going.
You might want to learn about programming in JSP and Servelets. JSP s are kinda like php in that they emit html out.
Also the server would be tomcat.
It would be best if you download Eclipse for EE developers. You can also try Netbeans. a sample servelet
You may read about servlets which is the basis for web applications in Java. There are many web frameworks built on top of them.
I always recommend Grails to anyone getting started with java/the web. It's more important to grasp the patterns, lifecycle, and working with requests and responses than learning the actual language. Learning Grails has got me from hobbyist developer to IT employee working with ATG - one of the most obscenely challenging web frameworks there are.
Grails includes everything you need to get started: local server, scaffolding (that's your ticket to Hello World), database access, dependency injection, the list goes on. It's built on top of Spring, Hibernate, Sitemesh, etc, which are all well-known and excellent frameworks that are being used in production.
Grails is written with Groovy, a language written on top of the JVM not far from Java.
Happy coding!
i seems to be new to the platform nd new to java but would like to suggest what i have gained till now that for developing a java page we can have any of the two servers downloaded(Weblogic or tomcat). weblogic is fully implementation of classes whereas tomcat has partial implementation. Then for the next step that we require is a source file(java file),and html file and a xml file and these all needs to be placed in a root directory as like the source file,html file and a folder named WEB-INF to be placed parallel.
Inside WEB-INF folder needs to create classes folder where our java class file will be kept.
then needs to create a .war file and deploy it over weblogic to get our desired page display.
thanks......

Integrating python webapp with some jar files

Hi I have few jar files which are few calculations compiled into jar files. I have a python web app which is supposed to interact with these jar files and get me the data. I have heard that it can be done using the java bridge. Can someone let me know how this could be done or at least point me to the right link.
I think what you are looking for is jython.You can interact back and forth between python and java using jython.
You could always run the jar files in a subprocess and use PIPE for IO (or temp files). This works pretty well for us (we are generating PDF from our Django app with flying saucer and iText)

How should I architect JasperReports with a PHP front+backend system

Our system is written completely in PHP.
For various business reasons (which are a given) I need to build the reports of the system using JasperReports.
What architecture should I use? Should I put the Jasper as a stand alone server (if possible) and let the php query against it, should I have it generate the reports with a cron, and then let the PHP scoop up the files and send them to the web client/browser...
JasperServer seems to be the best option, having:
Comprehensive Web Services, Java, and HTTP APIs, as well as support for Web Services from non-Java environments such as .NET (C#), C++, and PHP
Another option is to implement something like that yourself, with only the functionality you need. Make a separate java web-app that generates the reports, using either web-services or REST to communicate with it.
If you like to keep things simple and "free", then i recommend:
Build your own small Java webapp.
Use DynamicJasper to build customized reports.
Expose a web service from the Java app, and call it from your PHP.
Java app will reply with a PDF file.
You can use the php java extension and compile and generate the report right from php. Example code and instructions: here.

Categories