Solved

Calling java class through PHP

Posted on 2006-10-25
8
2,512 Views
Last Modified: 2008-01-09
Hi, i have a java class ..ie: runApplet.java and once built, runApplet.class
I also have a website where the user presses the start button and the applet is supposed to run...
however i cannot figure out a way, in PHP, to actually call that java applet...
It works with HTML...but how do it in PHP??

Thanks...
0
Comment
Question by:Squadless
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 4

Expert Comment

by:anilande
ID: 17809386
have a look at this

http://in.php.net/java
0
 
LVL 18

Expert Comment

by:Mark Gilbert
ID: 17811282
You may find the xajax project useful: www.xajaxproject.org
0
 
LVL 48

Expert Comment

by:hernst42
ID: 17811843
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:Squadless
ID: 17812844
so basically in other words i cannot call a java class by something like
some syntax statement (classname);

where the some syntax stmt would call the class to be executed??...
0
 
LVL 48

Expert Comment

by:hernst42
ID: 17812929
No typcial not so easy.

The quest is why do youn want to run a JavaApplet on the Server if the applet is supposed to run in the Browser of the user?
0
 
LVL 1

Author Comment

by:Squadless
ID: 17812965
What about lets say its not an Applet.
Lets say i have a Login button which when pressed has to execute java code that will authenticate and perform some other security features.
so i have a class "sec.java"..

i do not really wish to "integrate" php and java, i just want that class to be called and executed from the same path.
There is no simple way to do that?...or whats the best way without "integrating"
0
 
LVL 1

Author Comment

by:Squadless
ID: 17813033
on some sites i see this...

<?php
// get instance of Java class java.lang.System in PHP
$system = new Java('java.lang.System');
...
...
...

would that be appropriate for me...i would put method calls in the constructor of the class being instanciated and then it would execture from there....does that sound good or..?
0
 
LVL 4

Accepted Solution

by:
anilande earned 500 total points
ID: 17816976
if u just want to execute a java class with or without passing command line parameters then u can fire java compiler/inter.. using the exec command

the statement will be some thing likw this

$returnvalue=`<path_to_java_compiler>/java java.class`;
echo $returnvalue;

or

$cmd="<path_to_java_compiler>/java java.class";
exec($cmd, $returnvalue);
echo $returnvalue;

or

$cmd="<path_to_java_compiler>/java java.class";
system($cmd, $returnvalue);
echo $returnvalue;


and more...


anilande
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article discusses four methods for overlaying images in a container on a web page
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question