开发者

Accesing file in the running applet archive present at the Tomcat server from the client

I have an applet attached to an HTML page like this.

<applet code="Test1.OperatorEntryApp.class" archive="SignedJar.jar"
        width=1100 height=900 align="center">

Now the SignedJar.jar contains 2 jar files and 2 class file folders. Say Test1.jar and Test2.jar.

Now when I access the page at a client side and click a button on the page, I want the second Jar, that is Test2.jar to be run on the client side.

What should I do?

Think about it like this.

Suppose I give 2 urls with these 2 jars separately, the client has 2 open 2 webpages on his browser. But what I want to do is, make the operation automatic. He will open only one webpage an开发者_运维知识库d the second jar should run automatically [as a different application] through the first.


If I understand right, your two jars contain standalone applications, not applets, and your signed jar contains an applet. Right?

In the simplest case, you can simply extract your two Test1.jar and Test2.jar to files in the file system, and then call java -jar Test1.jar and java -jar Test2.jar to execute them. Use Runtime.exec for this.

If you want to run them inside the applet's VM, you will either have to create a class loader which can load classes from a nested jar, or still need to extract them and use a URLClassLoader. Then call the jar's main classes by reflection.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜