简体   繁体   English

php-java桥中的ClassNotFoundexception

[英]ClassNotFoundexception in php-java bridge

I am new to php/java bridge 我是php / java桥的新手

<?php

require_once("localhost:8087/JavaBridge/java/Java.inc");
$world = new java("Test");
    echo $world->query("sample");
?>

this is my php file for calling a desktop application's Test class, but it is showing an ClassNotfoundException. 这是我用于调用桌面应用程序的Test类的php文件,但它显示的是ClassNotfoundException。

Check if your Java class is inside a package. 检查您的Java类是否在包中。 If the class is inside a package (eg. com.stackoverflow) you need to instanziate your class with the package name: 如果类在包中(例如com.stackoverflow),则需要使用包名实例化类:

$world = new java("com.stackoverflow.Test");

Without the exception it looks like you lack the test class in your jvm classpath. 没有例外,看起来你缺少jvm类路径中的测试类。 You say you want to run a desktop application, so I would suggest you go through this guide (Again? :), to see if you missed something in the setup. 你说你想运行一个桌面应用程序,所以我建议你仔细阅读本指南 (再次?:),看看你是否遗漏了设置中的内容。

Also you could remove the enter code here block. 你也可以在enter code here删除enter code here块。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM