Last change
on this file since 24353 was 20709, checked in by ak19, 15 years ago |
Dr Bainbridge edited the code to make it safer C++ and to fix bugs and possibly memory issues, since there is a bus error on MacOs 10.4 (Tiger) on Veronica's Macbook Pro.
|
File size:
1.3 KB
|
Line | |
---|
1 | #include <cstdlib>
|
---|
2 | #include <cstring>
|
---|
3 | #include <iostream>
|
---|
4 | #include <fstream>
|
---|
5 | #include <string>
|
---|
6 | #include <sstream>
|
---|
7 | #include <sys/stat.h>
|
---|
8 | using namespace std;
|
---|
9 | #ifdef WINDOWS
|
---|
10 | #include <windows.h>
|
---|
11 | #endif
|
---|
12 |
|
---|
13 |
|
---|
14 | void replace_all( std::string & str, std::string const & pattern, std::string const & replacement );
|
---|
15 | int process( string command, bool render );
|
---|
16 | int process_and_catch_output( string command, string &output );
|
---|
17 | #ifdef WINDOWS
|
---|
18 | int regSearch(HKEY hKey, const char* keyName, int searchType, char* foundJavaVer );
|
---|
19 | #endif
|
---|
20 |
|
---|
21 |
|
---|
22 | class Jvm {
|
---|
23 |
|
---|
24 | // version string. era.major.minor_update. eg: 1.4.2_02
|
---|
25 | int era_;
|
---|
26 | int major_;
|
---|
27 | int minor_;
|
---|
28 | int update_;
|
---|
29 |
|
---|
30 | string javaHome_;
|
---|
31 | bool isJdk_;
|
---|
32 | bool healthy_;
|
---|
33 |
|
---|
34 | public:
|
---|
35 | Jvm();
|
---|
36 | ~Jvm();
|
---|
37 |
|
---|
38 | void setJavaHome( string jh );
|
---|
39 | string getJavaHome();
|
---|
40 | string getExecutable();
|
---|
41 | #ifdef WINDOWS
|
---|
42 | string getWinExecutable();
|
---|
43 | #endif
|
---|
44 | string getVersion();
|
---|
45 | bool check();
|
---|
46 | bool setVersionFromString( string version );
|
---|
47 | int compare( Jvm otherJvm );
|
---|
48 | int getEra();
|
---|
49 | int getMajor();
|
---|
50 | int getMinor();
|
---|
51 | int getUpdate();
|
---|
52 |
|
---|
53 | bool getIsJre();
|
---|
54 | bool getIsJdk();
|
---|
55 |
|
---|
56 | private:
|
---|
57 | void setVersionFromExeOuput();
|
---|
58 | void setIsJdkFromJavacPresence();
|
---|
59 |
|
---|
60 | };
|
---|
61 |
|
---|
62 |
|
---|
63 |
|
---|
64 | bool find( Jvm &jvm, bool use_minimum, const Jvm& minimum, bool jreOnly, bool jdeOnly, string phint, string hint, bool verbose );
|
---|
Note:
See
TracBrowser
for help on using the repository browser.