Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/203.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jetty 9无法在Android上运行_Android_Embedded Jetty - Fatal编程技术网

Jetty 9无法在Android上运行

Jetty 9无法在Android上运行,android,embedded-jetty,Android,Embedded Jetty,我试图在Android 4.2上使用Jetty 9,但我遇到了一个例外: 05-20 16:27:44.230: E/dalvikvm(27558): Could not find class 'org.eclipse.jetty.server.Server', referenced from method com.example.jettydemoappproject.JettyMainActivity.onCreate 05-20 16:27:44.285: E/AndroidRuntime

我试图在Android 4.2上使用Jetty 9,但我遇到了一个例外:

05-20 16:27:44.230: E/dalvikvm(27558): Could not find class 'org.eclipse.jetty.server.Server', referenced from method com.example.jettydemoappproject.JettyMainActivity.onCreate
05-20 16:27:44.285: E/AndroidRuntime(27558): FATAL EXCEPTION: main
05-20 16:27:44.285: E/AndroidRuntime(27558): java.lang.NoClassDefFoundError: org.eclipse.jetty.server.Server
05-20 16:27:44.285: E/AndroidRuntime(27558): at com.example.jettydemoappproject.JettyMainActivity.onCreate(JettyMainActivity.java:36)
代码(JettyMainActivity.java):

我已将此JAR添加到“libs”项目文件夹(并添加到构建路径):

jetty-continuation-9.0.3.v20130506.jar
jetty-http-9.0.3.v20130506.jar
jetty-io-9.0.3.v20130506.jar
jetty-security-9.0.3.v20130506.jar

jetty-server-9.0.3.v20130506.jarjetty 9.x需要Java 1.7(或更新版本)


它不能在Android上运行,因为Android是Java 1.5。

我在jetty 7.0中遇到了同样的错误。你找到解决方案了吗??现在Android对Java 1.7有一定的支持,这会起作用吗?如果有人想知道,它在Android 4.2.2上不会起作用,因为
Java.util.concurrent.ConcurrentHashMap.newKeySet
甚至使用最新的Android Studio编译。
import org.eclipse.jetty.server.Server;
....
public class JettyMainActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_jetty_main);

        Server webServer = new Server(8080);
        ....
        }
 }
jetty-continuation-9.0.3.v20130506.jar
jetty-http-9.0.3.v20130506.jar
jetty-io-9.0.3.v20130506.jar
jetty-security-9.0.3.v20130506.jar
jetty-server-9.0.3.v20130506.jar <-- this one contains 'org.eclipse.jetty.server.Server'
jetty-servlet-9.0.3.v20130506.jar
jetty-util-9.0.3.v20130506.jar
jetty-webapp-9.0.3.v20130506.jar
jetty-xml-9.0.3.v20130506.jar
servlet-api-3.0.jar