在服务器上运行一个jar文件

在服务器上运行一个jar文件

本文介绍了在服务器上运行一个jar文件.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为main.jar的jar文件,其中Manifest条目为:

I have a jar file named main.jar with the Manifest entry as:

Main-Class : tss.Report
Class-Path : lib/Classes12.jar lib/xlist.jar lib/axis2.jar



现在,我的lib文件夹与jar文件位于同一目录,并且我也可以通过使用"java -jar"命令从命令提示符运行jar.

但是,每当我将带有lib文件夹的jar放置到服务器上,并尝试从Linux环境使用相同的命令调用jar时,都会收到一条错误消息,例如:由于损坏或格式错误而无法访问jar文件

即使我尝试通过将main.jar放置在具有客户端类的文件夹中并尝试将清单文件相应地更改为:
,服务器上也有一个clientclasses文件夹



now I have the lib folder in the same directory as that of the jar file and I am able to run the jar also from command prompt by using "java -jar" command.

But whenever I place the jar with the lib folder to my server and try to invoke the jar using same command from linux environment I get an error message saying something like :Cannot access the jar file because it is corrupt or in bad format.

I have a clientclasses folder in the server evenif I tried by placing my main.jar in the folder that has the clientclasses and changed the Manifest file accordingly as :

Main-Class : tss.Report
Class-Path : clientclasses/Classes12.jar clientclasses/xlist.jar clientclasses/axis2.jar


但没有成功.

我想到的另一种方法是:
在我自己的应用程序服务器中对程序进行编码,并从应用程序集中安排我的程序的运行,以在应用程序服务器中运行.
我可以直接从应用程序服务器运行我的应用程序吗,如果可以,那么我必须在服务器中现有应用程序的哪个文件中安排程序的运行时间,换句话说,这是文件还是可以使用的方法是什么?运行我的应用程序.

请帮助我了解如何从服务器运行一个包含多个依赖jar的jar.


but with no success.

Alternate method I thought of is:
coding my program in the application server it self and Scheduling the run of my program from the application set to run in application server.
Can I directly run my application from the application server .If yes then in which file of the existing application in the server I have to schedule the run of my program.In other words which is the file or what is the method that I can use to run my application.

Kindly help me to know how to run a jar having more than one dependent jars from server.

推荐答案


这篇关于在服务器上运行一个jar文件.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 07:29