本文整理汇总了PHP中java_require函数的典型用法代码示例。如果您正苦于以下问题:PHP java_require函数的具体用法?PHP java_require怎么用?PHP java_require使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了java_require函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cargar_jasper
protected function cargar_jasper()
{
if (!defined("JAVA_HOSTS")) {
define("JAVA_HOSTS", "127.0.0.1:8081");
}
//Incluimos la libreria JavaBridge
require_once "3ros/JavaBridge/java/Java.inc";
//Creamos una variable que va a contener todas las librerías java presentes
$path_libs = toba_dir() . '/php/3ros/JasperReports';
$classpath = '';
try {
$archivos = toba_manejador_archivos::get_archivos_directorio($path_libs, '|.*\\.jar$|', true);
foreach ($archivos as $archivo) {
$classpath .= "file:{$archivo};";
}
} catch (toba_error $et) {
toba::logger()->error($et->getMessage());
//No se encontro el directorio, asi que no agrega nada al path y sigue el comportamiento que tenia con opendir
}
try {
//Añadimos las librerías
java_require($classpath);
//Creamos el objeto JasperReport que permite obtener el reporte
$this->jasper = new JavaClass("net.sf.jasperreports.engine.JasperFillManager");
} catch (JavaException $ex) {
$trace = new Java("java.io.ByteArrayOutputStream");
$ex->printStackTrace(new Java("java.io.PrintStream", $trace));
print "java stack trace: {$trace}\n";
} catch (java_ConnectException $e) {
toba::logger()->error($e->getMessage());
throw new toba_error_usuario('No es posible generar el reporte, el servlet Jasper no se encuentra corriendo');
}
}
示例2: go
public function go()
{
$fopcfg = dirname(__FILE__) . '/fop_config.xml';
$tmppdf = tempnam('/tmp', 'FOP');
if (!extension_loaded('java')) {
$tmpxml = tempnam('/tmp', 'FOP');
$tmpxsl = tempnam('/tmp', 'FOP');
file_put_contents($tmpxml, $this->xml);
file_put_contents($tmpxsl, $this->xsl);
exec("fop -xml {$tmpxml} -xsl {$tmpxsl} -pdf {$tmppdf} 2>&1");
@unlink($tmpxml);
@unlink($tmpxsl);
} else {
$xml = new DOMDocument();
$xml->loadXML($this->xml);
$xsl = new DOMDocument();
$xsl->loadXML($this->xsl);
$proc = new XSLTProcessor();
$proc->importStyleSheet($xsl);
$java_library_path = 'file:/usr/share/fop/lib/fop.jar;file:/usr/share/fop/lib/FOPWrapper.jar';
try {
java_require($java_library_path);
$j_fwc = new JavaClass("FOPWrapper");
$j_fw = $j_fwc->getInstance($fopcfg);
$j_fw->run($proc->transformToXML($xml), $tmppdf);
} catch (JavaException $ex) {
$trace = new Java("java.io.ByteArrayOutputStream");
$ex->printStackTrace(new Java("java.io.PrintStream", $trace));
print "java stack trace: {$trace}\n";
}
}
return $tmppdf;
}
示例3: loadObject
function loadObject($gateway)
{
$CI =& get_instance();
$this->object_loaded = TRUE;
define("JAVA_HOSTS", $gateway['url'] . ':' . $gateway['port']);
if (!@(include_once $CI->config->item('java_include_path') . "JavaBridge/java/Java.inc")) {
require_once $CI->config->item('java_include_path') . "JavaBridge/java/Java.inc";
}
java_require($CI->config->item('java_include_path') . "java/lib");
$this->ECCOClient = new Java("com.edgil.ecco.eccoapi.ECCOClient", "PHPTestECCO", $CI->config->item('java_include_path') . "java/ecco/data/ECCO.properties");
// define ECCOStatusCodes object for ECCO Constants...
$this->ECCOStatusCodes = new Java("com.edgil.ecco.eccoapi.ECCOStatusCodes");
$this->pass = array("C", "h", "a", "n", "g", "e", "I", "t");
$this->alias = array("e", "d", "g", "i", "l", "c", "a");
}
示例4: search
function search($pQuery)
{
global $gBitSystem;
$this->mResults = array();
$this->mHits = 0;
if (!empty($pQuery) && $this->verifySearchIndex()) {
parent::search($pQuery);
// use java wddx
$query = $pQuery;
java_require(LUCENE_PKG_PATH . 'indexer/lucene.jar;' . LUCENE_PKG_PATH . 'indexer');
$obj = new Java("org.bitweaver.lucene.SearchEngine");
$result = $obj->search($this->getField('index_path'), "OR", $query, $this->getField('index_fields'));
if ($meta = $result->get('meta_data')) {
$this->mHits = (string) $meta->get('hits');
} else {
$this->mHits = 0;
}
$this->mResults = $result->get('rows');
}
return count($this->mResults);
}
示例5: java_set_library_path
function java_set_library_path($arg)
{
return java_require($arg);
}
示例6: validate_login_ntlm
static function validate_login_ntlm($username, $password)
{
if (!function_exists("java_get_base")) {
require "lib/java/java.php";
}
if (!function_exists("java_require")) {
sys_log_message_alert("login", sprintf("{t}%s is not compiled / loaded into PHP.{/t}", "PHP/Java Bridge"));
return false;
}
java_require("jcifs-1.3.8_tb.jar");
$conf = new JavaClass("jcifs.Config");
$conf->setProperty("jcifs.smb.client.responseTimeout", "5000");
$conf->setProperty("jcifs.resolveOrder", "LMHOSTS,DNS");
$conf->setProperty("jcifs.smb.client.soTimeout", "10000");
$conf->setProperty("jcifs.smb.lmCompatibility", "0");
$conf->setProperty("jcifs.smb.client.useExtendedSecurity", false);
$auth = sys_get_header("Authorization");
$session = new JavaClass("jcifs.smb.SmbSession");
$result = new Java("jcifs.smb.NtlmPasswordAuthentication", "", $username, $password);
$username = $result->getUsername();
if (SETUP_AUTH_NTLM_SHARE) {
$w = new Java("jcifs.smb.SmbFile", SETUP_AUTH_NTLM_SHARE, $result);
$message = $w->canListFiles();
if ($message == "Invalid access to memory location.") {
header("Location: index.php");
exit;
}
} else {
$message = $session->logon(SETUP_AUTH_HOSTNAME_NTLM, $result);
}
if ($message != "" or $username == "") {
sys_log_message_alert("login", sprintf("{t}Login failed from %s.{/t} (ntlm) ({t}Username{/t}: %s, %s)", _login_get_remoteaddr(), $username, $message));
return false;
}
$_SERVER["REMOTE_USER"] = modify::strip_ntdomain($username);
if (empty($_REQUEST["folder"])) {
$_REQUEST["redirect"] = 1;
}
return true;
}
示例7: JavaException
throw new JavaException("java.lang.Exception", "bleh!");
// not reached
echo "ERROR.\n";
exit(3);
}
function c2($b)
{
echo "c2: {$b}\n";
return $b;
}
function c3($e)
{
echo "c3: {$e}\n";
return 2;
}
}
$here = realpath(dirname($_SERVER["SCRIPT_FILENAME"]));
if (!$here) {
$here = getcwd();
}
java_require("{$here}/callback.jar");
$c = new c();
$closure = java_closure($c, null, java("Callback"));
$callbackTest = new java('Callback$Test', $closure);
if ($callbackTest->test()) {
echo "test okay\n";
exit(0);
} else {
echo "test failed\n";
exit(1);
}
示例8: realpath
#!/usr/bin/php
<?php
include_once "java/Java.inc";
$here = realpath(dirname($_SERVER["SCRIPT_FILENAME"]));
if (!$here) {
$here = getcwd();
}
java_require("{$here}/numberTest.jar");
$test = new java('NumberTest');
print "getInteger() = ";
echo $test->getInteger();
echo "<br>\n";
print "getPrimitiveInt() = ";
echo $test->getPrimitiveInt();
echo "<br>\n";
print "getFloat() = ";
echo $test->getFloat();
echo "<br>\n";
print "getPrimitiveFloat() = ";
echo $test->getPrimitiveFloat();
echo "<br>\n";
print "getDouble() = ";
echo $test->getDouble();
echo "<br>\n";
print "getPrimitiveDouble() = ";
echo $test->getPrimitiveDouble();
echo "<br>\n";
print "getBigDecimal() = ";
echo $test->getBigDecimal();
echo "<br>\n";
示例9: session_start
<?php
session_start();
?>
<?php
echo "hello";
//java_require("/usr/lib/jvm/java-7-openjdk-i386/jre/lib/ext/calculator.jar");
//require_once("java/Java.inc");
require_once "http://127.0.0.1:8081/JavaBridge/java/Java.inc";
echo "hello1.5";
java_require("calculator.jar");
//java("demo.rfc.test.RpcConsumer")->main();
java_require("demo.jar");
$CA = new Java("calculator.CalculatorBean");
//$RC = new Java("calculator.test.RpcConsumer2");
$RC = new Java("demo.rpc.test.RpcConsumer2");
$RC->test();
$session = java_session();
if (is_null(java_values($calcinstance = $session->get("calculatorInstance")))) {
$session->put("calculatorInstance", $calcinstance = new Java("calculator.CalculatorBean"));
}
echo "hello2";
$result = 0;
$opr = "none";
$term_1 = 0;
$term_2 = 0;
if (isset($_POST['operationName'])) {
$opr = $_POST['operationName'];
}
if (isset($_POST['term1Name'])) {
示例10: define
<?php
define("JAVA_PREFER_VALUES", true);
require_once "java/Java.inc";
$system = new java("java.lang.System");
$t1 = $system->currentTimeMillis();
$here = getcwd();
// load scheme interpreter
// try to load local ~/lib/kawa.jar, otherwise load it from sf.net
try {
java_require("kawa.jar");
} catch (JavaException $e) {
java_require("http://php-java-bridge.sourceforge.net/kawa.jar");
}
$s = new java("kawa.standard.Scheme");
for ($i = 0; $i < 100; $i++) {
$res = java_cast($s->eval("\n\n(letrec\n ((f (lambda(v)\n (if \n\t (= v 0)\n\t 1\n\t (*\n\t (f\n\t (- v 1))\n\t v)))))\n (f {$i}))\n\n"), "D");
if ($ex = java_last_exception_get()) {
$res = $ex->toString();
}
java_last_exception_clear();
echo "fact({$i}) ==> {$res}\n";
}
$t2 = $system->currentTimeMillis();
$delta = ($t2 - $t1) / 1000.0;
$now = new java("java.sql.Timestamp", $system->currentTimeMillis());
echo "Evaluation took {$delta} s -- at: {$now}\n";
示例11: JavaClass
#!/usr/bin/php
<?php
include_once "java/Java.inc";
$Array = new JavaClass("java.lang.reflect.Array");
$testobj = $Array->newInstance(new JavaClass("java.lang.String"), array(2, 2, 2, 2, 2, 2));
$testobj[0][0][0][0][0][1] = 1;
$testobj[0][0][0][0][1][0] = 2;
$testobj[0][0][0][1][0][0] = 3;
$testobj[0][0][1][0][0][0] = 4;
$testobj[0][1][0][0][0][0] = 5;
$testobj[1][0][0][0][0][0] = 6;
$here = realpath(dirname($_SERVER["SCRIPT_FILENAME"]));
if (!$here) {
$here = getcwd();
}
java_require("{$here}/array6.jar");
$array6 = new java("Array6");
$success = java_values($array6->check($testobj));
var_dump(java_values($testobj[0][0][0][0]));
if (!$success) {
echo "ERROR\n";
exit(1);
}
echo "test okay\n";
exit(0);
示例12: foreach
$prms['init'] = $_GET['init'];
if (is_array($parameters) && count($parameters) > 0) {
foreach ($parameters as $ky => $vl) {
$prms['prompt' . $ky] = $_GET['prompt' . $ky] = $vl;
}
}
unset($_GET['parameters']);
$inetreportsfiles = isset($sess_usertype_short) && (trim($sess_usertype_short) == 'OA' || trim($sess_usertype_short) == 'OU') ? $inetreportsfiles . '/adminrpt' : $inetreportsfiles . '/userrpt';
//
// pr($_GET); exit;
set_time_limit(0);
/*$params = http_build_query($prms);
echo "<iframe src='http://localhost:9000/?".$params."' width='730px' height='467px' style='overflow:hidden;' />";
exit;*/
require_once "http://localhost:8080/JavaBridge/java/Java.inc";
java_require("{$inetcorehome}/ClearReports.jar;{$inetcorehome}/ReportViewer.jar;{$inetcorehome}/CCLib.jar;{$javalib}/mysql-connector-java-5.1.10.jar");
/*
* Helper function to get the request property bag from the
* get and post parameters
*/
function clearreports_get_request_properties($get, $post)
{
$p = new Java("java.util.Properties");
foreach ($post as $key => $val) {
$p->put($key, $val);
}
foreach ($get as $key => $val) {
$p->put($key, $val);
}
// Add the client language that the browser has sent. Useful for
// multi-language reports.
示例13: isint
if (!checkdate($bloques[2], $bloques[1], $bloques[3])) {
return false;
}
} else {
return false;
}
return true;
}
function isint($mixed)
{
return preg_match('/^\\d*$/', $mixed) == 1;
}
//error_reporting(E_ERROR);
require_once "JasperReports.php";
include "phpjasper/Java.inc";
java_require(dirname(__FILE__) . "/phpjasper/drivers.jar");
$dir = dirname(__FILE__) . "/phpjasper/Pool/";
$URLBASE = $SYS["BASE"] . "/Apps/JasperReports//phpjasper/Pool/";
/*
try {*/
foreach ($_GET as $var => $dat) {
$dati = urldecode($dat);
$dato = str_replace("\\'", "'", $dati);
//$dato = $dat;
if ($var != "rewrite" && $var != "petition") {
if ($var == "ROOT") {
$atomParam = array();
$atomParam["paraname"] = "ROOT";
$atomParam["paratype"] = "Cadena";
$atomParam["value"] = $SYS["ROOT"];
$P[] = $atomParam;
示例14: getcwd
<?php
include_once "java/Java.inc";
$here = getcwd();
java_require("{$here}/hashSetFactory.jar");
$hash = java("HashSetFactory")->getSet();
$hash->add(1);
$hash->add(3);
foreach ($hash as $key => $val) {
echo "{$key}=>{$val}\n";
}
示例15: java_require
<?php
require_once "http://127.0.0.1:8081/JavaBridge/java/Java.inc";
java_require("calculator.jar");
java_require("rpc.jar");
class JavaHandler
{
function get()
{
echo "hello Java Handler here";
$CA = new Java("calculator.CalculatorBean");
$session = java_session();
if (is_null(java_values($calcinstance = $session->get("calculatorInstance")))) {
$session->put("calculatorInstance", $calcinstance = new Java("calculator.CalculatorBean"));
}
echo "<br>after calcultator";
echo "<br>session from java = " . java_values($calcinstance = $session->get("calculatorInstance"));
if (eregi('^/java/rpc/*', $_SERVER['REQUEST_URI'])) {
$RPC = new Java("rpc.test.RpcConsumer");
$RPC->test();
echo "<br> RPC Service on 8082 ";
}
}
function post_xhr()
{
if (eregi('^/login/*', $_SERVER['REQUEST_URI'])) {
}
}
}