Solved

Calling java class through PHP

Posted on 2006-10-25
8
2,449 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:ingwa
ID: 17811282
You may find the xajax project useful: www.xajaxproject.org
0
 
LVL 48

Expert Comment

by:hernst42
ID: 17811843
0
 
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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
htacces issue 2 41
Wordpress syntax error 1 29
Jquery Autocomplete PHP script 3 21
Codiing Non-Existent Links 4 28
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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 …

760 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now