如何用终端调用jar文件中的方法? [英] How to call method in jar file with terminal?

查看:96
本文介绍了如何用终端调用jar文件中的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在jar文件中有一个已编译的项目,我需要从它调用一个方法。如何在ubuntu终端中执行此操作?

I have a compiled project in a jar file and I need to call a method from it.How can I do that in ubuntu terminal?

推荐答案

您不能从任何类的终端或cmd调用任何方法。

You can not call any method from terminal or cmd of any class.

你可以通过终端执行课程。

You can execute class through terminal.

如果你的 jar 是可执行的尝试: java -jar你的Jar的名字

If your jar is executable try: java -jar "Name of your Jar"

或者设置类的路径你的jar: java -classpath path-to-jar< package>。< classname>

Or set the class path of your jar: java -classpath path-to-jar <package>.<classname>

这篇关于如何用终端调用jar文件中的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆