开发者

How to export all installed versions of Java to a text file under Windows XP

开发者 https://www.devze.com 2023-01-13 23:12 出处:网络
I\'m looking to write a batch file I can deploy to 20-30 users that will export all of the enabled versions of Java out to a text file, which I can then pick up, and add to a troubleshooting effort we

I'm looking to write a batch file I can deploy to 20-30 users that will export all of the enabled versions of Java out to a text file, which I can then pick up, and add to a troubleshooting effort we're working on.

I know that java -version will show the current version, but we're in an environment where we have multiple applications that use d开发者_如何转开发ifferent versions.

Thanks, Josh


Assuming your runtimes are all in the same folder, You can grab the "JAVA_HOME" environment variable then just print a list of the folders in the parent directory of wherever it points.

However individual applications can bundle their own runtimes, which can be anywhere pretty much.

Since you reference -version though, I assume you are using it from the command line so pulling in JAVA_HOME and looking around there seems like a good place to start.


Have a look at the Java Deployment Tookit with its method getJREs(). This returns an array of currently installed Java Runtime Environments.

Please be advised, that this a JavaScript and you probably won't be able to use it from command line.

0

精彩评论

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