|
From: <php...@li...> - 2009-04-27 06:24:00
|
Hello Jost,
the underlined part of the code does not work. Is it the right way to find a class in the jar?
<?php
require_once("http://localhost:8081/Ordner/java/Java.inc");
$System = java("java.lang.System");
$myObj = new java("WebProjekt2.web.FacettenBrowser");
echo (String) $myObj->HalloWelt();
?>
I get such an errormessage:
root cause java.lang.RuntimeException: PHP Fatal error: Uncaught [[o:Exception]:"java.lang.Exception: CreateInstance failed: new WebProjekt2.web.FacettenBrowser. Cause: java.lang.ClassNotFoundException: WebProjekt2.web.FacettenBrowser VM: 1.6.0_10@http://java.sun.com/" at:
#-11 org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
#-10 org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
#-9 java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
#-8 java.lang.Class.forName0(Native Method)
#-7 java.lang.Class.forName(Class.java:247)
#-6 php.java.bridge.SimpleJavaBridgeClassLoader.forName(SimpleJavaBridgeClassLoader.java:157)
#-5 php.java.bridge.JavaBridge.CreateObject(JavaBridge.java:455)
#-4 php.java.bridge.Request.handleRequest(Request.java:452)
#-3 php.java.bridge.Request.handleRequests(Request.java:490)
#-2 php.java.bridge.http.ContextRunner.run(ContextRunner.java:146)
#-1 php.java.bridge.ThreadPool$Delegate.run(ThreadPool.java:60)
#0 http://localhost:8081/Ordner/java/Java.inc(248): java_ThrowE in http://localhost:8081/Ordner/java/Java.inc on line 215
php.java.servlet.fastcgi.FastCGIServlet$CGIRunner.parseBody(FastCGIServlet.java:484)
php.java.servlet.fastcgi.FastCGIServlet$CGIRunner.doExecute(FastCGIServlet.java:379)
php.java.servlet.fastcgi.FastCGIServlet$CGIRunner.execute(FastCGIServlet.java:387)
php.java.servlet.CGIServlet.handle(CGIServlet.java:399)
php.java.servlet.PhpCGIServlet.handle(PhpCGIServlet.java:382)
php.java.servlet.CGIServlet.doGet(CGIServlet.java:469)
javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.18 logs.
you have to put the class "HelloWorld" into the "HalloWelt.web" package.
so it looks like
[code]
package HalloWelt.web;
import ....;
public class HelloWorld{
public HelloWorld() { /* do something */ }
}
[/code]
2009/4/24 <php...@li...>
> Hello,
> in my jar file there are many classes, and the class which I need to access
> can't be found.
> I tryed to solve it so:
> $myObj = new java("HalloWelt.web.HelloWorld");
> but it does not work.Please tell me how can I access this class?
>
>
>
> Thank you in advance!
>
>
|