Guys,
How to check for java installation in windows, i want some code/pseudo code/algorithm..
Help me out.....
shankarjadhav 0 Newbie Poster
Recommended Answers
Jump to PostInteresting, well on the command line one would type
java -version
but you want to execute code within your program to determine the runtime version. Well I think this should work:Process java = Runtime.getRuntime().exec("cmd /C java -version"); BufferedReader in = new BufferedReader(new InputStreamReader(java.getInputStream())); String line; …
Jump to Postimport java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; class Test { public static void main(String args[]) throws IOException { Process java = Runtime.getRuntime().exec("cmd /C java -version"); BufferedReader in = new BufferedReader(new InputStreamReader(java.getInputStream())); String line; while ((line = in.readLine()) != null) System.out.println(line); } }
Well there are a few imports …
All 8 Replies
ksaxena 0 Light Poster
PoovenM 30 Junior Poster
shankarjadhav 0 Newbie Poster
shankarjadhav 0 Newbie Poster
PoovenM 30 Junior Poster
shankarjadhav 0 Newbie Poster
PoovenM 30 Junior Poster
Ezzaral 2,714 Posting Sage Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.