简体   繁体   中英

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. I need to first check whether my host machine is windows or Linux and then check the dotnet version. Is there a simpler way to do it in 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM