@name 获取JDK版本路径 @author lkq<2021-08-27> @param version @param is_independent 是否是独立版本 @return string
(self, version, is_independent=False)
| 832 | return public.returnMsg(False, '更改失败') |
| 833 | |
| 834 | def get_jdk_path(self, version, is_independent=False): |
| 835 | ''' |
| 836 | @name 获取JDK版本路径 |
| 837 | @author lkq<2021-08-27> |
| 838 | @param version<string> |
| 839 | @param is_independent<bool> 是否是独立版本 |
| 840 | @return string |
| 841 | ''' |
| 842 | if is_independent: |
| 843 | path = self.__site_path + '/%s/bin/daemon.sh' % version |
| 844 | else: |
| 845 | path = self.__bttomcat_path + '/tomcat%s/bin/daemon.sh' % version |
| 846 | if os.path.exists(path): |
| 847 | ret = public.ReadFile(path) |
| 848 | if isinstance(ret, str): |
| 849 | rec = "\nJAVA_HOME=.+" |
| 850 | if re.search(rec, ret): |
| 851 | jdk = re.search(rec, ret) |
| 852 | if not jdk: return '' |
| 853 | if jdk: |
| 854 | jdk = jdk.group(0).split('=')[1].strip() |
| 855 | return jdk |
| 856 | else: |
| 857 | return '' |
| 858 | else: |
| 859 | return '' |
| 860 | else: |
| 861 | return '' |
| 862 | |
| 863 | def format(self, em, level=0): |
| 864 | ''' |