简体   繁体   English

一罐小程序

[英]One-Jar for Applet

I have an applet that needs to import another libraries. 我有一个需要导入另一个库的小程序。 I used Apache Ant to build this applet and libraries into same jar files, but there is no way to connect classes with libraries. 我使用Apache Ant将小程序和库构建到相同的jar文件中,但是无法将类与库连接。 I got NoClassDefFoundError. 我收到了NoClassDefFoundError。

Because of that I decided to use one-jar with Ant. 因此,我决定将Ant与jar一起使用。 One-jar creates a jar files that contains libraries and classes. 一个jar创建一个包含库和类的jar文件。 But classes that I wrote are in another jar inside of main jar. 但是我编写的类位于主jar的另一个jar中。 Directory looks like below : 目录如下:

  • main.jar main.jar
    • com com
    • doc doc
    • lib LIB
    • main 主要
      • applets.jar applets.jar
        • MyApplet.class MyApplet.class

I need to access MyApplet class in applets.jar file but problem is that how can I import my applet class which is in second jar. 我需要访问applets.jar文件中的MyApplet类,但问题是如何导入第二个jar中的applet类。 It's not possible to write second attribute in applet tag. 无法在applet标记中写入第二个属性。

Is there any option in one-jar to build only one jar with libraries? 在一个jar中是否可以选择仅使用一个库构建一个jar? What should I use? 我应该使用什么?

It's not possible to write second attribute in applet tag. 无法在applet标记中写入第二个属性。

Then it is a good thing there is no need to. 那就没必要了,这是一件好事。 The archive attribute of the applet element can list multiple Jars, which is how you should approach this. applet元素的archive属性可以列出多个Jar,这是您应采用的方式。

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

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