Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Calling java class through PHP

Posted on 2006-10-25
8
Medium Priority
?
2,567 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
This article discusses four methods for overlaying images in a container on a web page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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.
Suggested Courses

971 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