|
1 /* |
|
2 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 //javac CheckTools.java -source 1.3 -target 1.3 |
|
19 |
|
20 import java.io.*; |
|
21 |
|
22 public class CheckTools |
|
23 { |
|
24 public static void main(String[] args) |
|
25 { |
|
26 try { |
|
27 Runtime runtime = Runtime.getRuntime(); |
|
28 |
|
29 Process toolProcess = runtime.exec("python -V"); |
|
30 InputStream err = toolProcess.getErrorStream(); |
|
31 if (!(toString(err).trim().startsWith("Python 2.5"))) |
|
32 { |
|
33 System.out.println("Error: Python 2.5 not found"); |
|
34 System.out.println(err); |
|
35 } |
|
36 |
|
37 toolProcess = runtime.exec("java -version"); |
|
38 err = toolProcess.getErrorStream(); |
|
39 if (!(toString(err).trim().startsWith("java version \"1.6"))) |
|
40 { |
|
41 System.out.println("Error: Java 6 not found"); |
|
42 System.out.println(err); |
|
43 } |
|
44 |
|
45 // toolProcess = runtime.exec("ant -version"); |
|
46 // err = toolProcess.getErrorStream(); |
|
47 // if (!(toString(err).trim().startsWith("Apache Ant version 1.7.0"))) |
|
48 // { |
|
49 // System.out.println("Error: Ant 1.7.0 not found"); |
|
50 // System.out.println(err); |
|
51 // } |
|
52 } catch (Exception e) { System.out.println(e); } |
|
53 } |
|
54 |
|
55 private static String toString(InputStream inputStream) throws IOException |
|
56 { |
|
57 byte[] buffer = new byte[4096]; |
|
58 OutputStream outputStream = new ByteArrayOutputStream(); |
|
59 |
|
60 while (true) { |
|
61 int read = inputStream.read(buffer); |
|
62 |
|
63 if (read == -1) { |
|
64 break; |
|
65 } |
|
66 |
|
67 outputStream.write(buffer, 0, read); |
|
68 } |
|
69 |
|
70 outputStream.close(); |
|
71 inputStream.close(); |
|
72 |
|
73 return outputStream.toString(); |
|
74 } |
|
75 |
|
76 } |
|
77 |
|
78 |