Last change
on this file since 20709 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
|
Rev | Line | |
---|
[18596] | 1 | #include <cstdlib>
|
---|
| 2 | #include <cstring>
|
---|
[15893] | 3 | #include <iostream>
|
---|
| 4 | #include <fstream>
|
---|
| 5 | #include <string>
|
---|
| 6 | #include <sstream>
|
---|
[18237] | 7 | #include <sys/stat.h>
|
---|
[15893] | 8 | using namespace std;
|
---|
[15897] | 9 | #ifdef WINDOWS
|
---|
| 10 | #include <windows.h>
|
---|
| 11 | #endif
|
---|
[15893] | 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
|
---|
[20709] | 25 | int era_;
|
---|
| 26 | int major_;
|
---|
| 27 | int minor_;
|
---|
| 28 | int update_;
|
---|
[15893] | 29 |
|
---|
[20709] | 30 | string javaHome_;
|
---|
| 31 | bool isJdk_;
|
---|
| 32 | bool healthy_;
|
---|
[15893] | 33 |
|
---|
| 34 | public:
|
---|
| 35 | Jvm();
|
---|
[20709] | 36 | ~Jvm();
|
---|
| 37 |
|
---|
[15893] | 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 |
|
---|
[18237] | 53 | bool getIsJre();
|
---|
| 54 | bool getIsJdk();
|
---|
| 55 |
|
---|
[15893] | 56 | private:
|
---|
[18237] | 57 | void setVersionFromExeOuput();
|
---|
| 58 | void setIsJdkFromJavacPresence();
|
---|
[15893] | 59 |
|
---|
| 60 | };
|
---|
| 61 |
|
---|
| 62 |
|
---|
| 63 |
|
---|
[20709] | 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.