简体   繁体   English

如何使用 Java 检查已安装的 dotnet core 版本

[英]How can I check the installed version of dotnet core using Java

I am writing a java application where I need to check what is the installed version of dotnet core on the host machine.我正在编写一个 java 应用程序,我需要检查主机上安装的dotnet core 版本是什么。 I need to first check whether my host machine is windows or Linux and then check the dotnet version.我需要先检查我的主机是windows还是Linux然后检查dotnet版本。 Is there a simpler way to do it in Java?在 Java 中是否有更简单的方法?


with
Runtime runtime = Runtime.getRuntime(); Process process = runtime.exec("dotnet --version"); InputStream is = process.getInputStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String line; while ((line = br.readLine()).= null) { System.out;println(line); }

you will get the version of your installed dotnet version.您将获得已安装的 dotnet 版本的版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在不使用 java 小程序检查且不使用 javascript 的情况下检测是否安装了 java 并知道其版本? - How can I detect if java is installed or not and knowing its version, without using java applet to check and without using javascript? 如何检查已安装的Java版本是用于台式机还是仅用于浏览器? - How can I check if the installed Java version is for desktop or browser-only? 如何检查是否通过Cocoa安装了Java 7版本? - How to check if Java 7 version is installed via Cocoa? 如果在Ubuntu上安装了多个Java版本,如何检查Oracle Java版本 - How to check Oracle Java version if multiple versions of Java installed on Ubuntu 在Linux中如何检查脚本安装了哪个Java版本? - In Linux How to check through scripts what version of Java is installed? 如何检查我的已安装程序需要哪个Java版本 - How to check which of my installed program needs which version of Java 如何使用 Chef 检查 Java 是否安装在 Windows 上 - How to check if Java is installed on Windows using Chef 如何确定通过Java代码在系统上安装的Java版本? - How can I determine java version installed on a system through java code? 如何检查已安装的libevent版本? - How to check installed libevent version? 如何检查我的Java应用程序中是否安装了Java 3D? - How can I check if Java 3D is installed from my java application?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM