Last change
on this file since 33004 was 18237, checked in by oranfry, 16 years ago |
added new options to search4j to only return a jre or only return a jre, and an option to display the type of the found jvm (whether jre or jdk)
|
File size:
1.2 KB
|
Line | |
---|
1 | #include <iostream>
|
---|
2 | #include <fstream>
|
---|
3 | #include <string>
|
---|
4 | #include <sstream>
|
---|
5 | #include <sys/stat.h>
|
---|
6 | using namespace std;
|
---|
7 | #ifdef WINDOWS
|
---|
8 | #include <windows.h>
|
---|
9 | #endif
|
---|
10 |
|
---|
11 |
|
---|
12 | void replace_all( std::string & str, std::string const & pattern, std::string const & replacement );
|
---|
13 | int process( string command, bool render );
|
---|
14 | int process_and_catch_output( string command, string &output );
|
---|
15 | #ifdef WINDOWS
|
---|
16 | int regSearch(HKEY hKey, const char* keyName, int searchType, char* foundJavaVer );
|
---|
17 | #endif
|
---|
18 |
|
---|
19 |
|
---|
20 | class Jvm {
|
---|
21 |
|
---|
22 | // version string. era.major.minor_update. eg: 1.4.2_02
|
---|
23 | int era;
|
---|
24 | int major;
|
---|
25 | int minor;
|
---|
26 | int update;
|
---|
27 |
|
---|
28 | string javaHome;
|
---|
29 | bool isJdk;
|
---|
30 | bool healthy;
|
---|
31 |
|
---|
32 | public:
|
---|
33 | Jvm();
|
---|
34 | void setJavaHome( string jh );
|
---|
35 | string getJavaHome();
|
---|
36 | string getExecutable();
|
---|
37 | #ifdef WINDOWS
|
---|
38 | string getWinExecutable();
|
---|
39 | #endif
|
---|
40 | string getVersion();
|
---|
41 | bool check();
|
---|
42 | bool setVersionFromString( string version );
|
---|
43 | int compare( Jvm otherJvm );
|
---|
44 | int getEra();
|
---|
45 | int getMajor();
|
---|
46 | int getMinor();
|
---|
47 | int getUpdate();
|
---|
48 |
|
---|
49 | bool getIsJre();
|
---|
50 | bool getIsJdk();
|
---|
51 |
|
---|
52 | private:
|
---|
53 | void setVersionFromExeOuput();
|
---|
54 | void setIsJdkFromJavacPresence();
|
---|
55 |
|
---|
56 | };
|
---|
57 |
|
---|
58 |
|
---|
59 |
|
---|
60 | bool find( Jvm &jvm, bool use_minimum, Jvm minimum, bool jreOnly, bool jdeOnly, string phint, string hint, bool verbose );
|
---|
Note:
See
TracBrowser
for help on using the repository browser.