如何在war文件中运行java类文件 [英] How to run java class file inside the war file
本文介绍了如何在war文件中运行java类文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个名为Sample.war的war文件。在这个war文件中,我有一个名为Maintest的主类。我想从战争的外面运行或执行Maintest类。如何做到这一点
i am having war file called Sample.war. in this war file i have the main class called "Maintest" .i want to run or execute the Maintest class from out side the war .how to do this
推荐答案
战争文件只是具有额外元数据的Jar文件。所以,你可以这样做:
War files are just Jar files with extra metadata. So, you should be fine to do:
java -classpath application.war Maintest
这将从war文件 application.war 加载类 Maintest 并运行它
That will load the class Maintest from the war file application.war and run it
这篇关于如何在war文件中运行java类文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文