在路径中使用通配符执行Jar [英] Execute a Jar with Wildcard in Path

查看:107
本文介绍了在路径中使用通配符执行Jar的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个启动jar文件的应用程序.但是,该jar的名称中包含版本号,并且每隔几个月就会更改一次.我希望编写此代码,因此不必在每次更改jar时都更新应用程序的代码.我尝试将*用作通配符,但得到:

I have an application that launches a jar file. However, the jar has the version number in the name and will change every few months. I'm looking to write this so I don't have to update the application's code every time the jar is changed. I've tried using * for a wildcard, but I get:

Error: Unable to access jarfile C:\Selenium\vendor\selenium-server-standalone-\*.jar

我正在运行的命令是:

java -jar C:\\Selenium\\vendor\\selenium-server-standalone-*.jar

输入版本号后,jar将成功启动.反正这里有使用通配符吗?

When I put in the version number, the jar launches successfully. Is there anyway to use a wildcard here?

推荐答案

不确定Windows,您在这里能做的最好的事情是编写一个最小的批处理文件,该文件可以抓住文件名并将其放在此处

Not sure about windows, the best you can do here is to write a minimal batch file that greps the file name and puts it right there

对于UNIX :您可以执行类似的操作

for unix: you could do something like

java -jar *.jar

这在Unix中效果很好

this works well in unix

这篇关于在路径中使用通配符执行Jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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