Solved

Calling java class through PHP

Posted on 2006-10-25
8
2,521 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
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!

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Suggested Solutions

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
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…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

739 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