[英]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 中是否有更简单的方法?
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.