MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / get_jdk_path

Method get_jdk_path

class/projectModel/javaModel.py:834–861  ·  view source on GitHub ↗

@name 获取JDK版本路径 @author lkq<2021-08-27> @param version @param is_independent 是否是独立版本 @return string

(self, version, is_independent=False)

Source from the content-addressed store, hash-verified

832 return public.returnMsg(False, '更改失败')
833
834 def get_jdk_path(self, version, is_independent=False):
835 ''&#x27;
836 @name 获取JDK版本路径
837 @author lkq<2021-08-27>
838 @param version<string>
839 @param is_independent<bool> 是否是独立版本
840 @return string
841 ''&#x27;
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 ''&#x27;

Callers 2

get_tomcat_infoMethod · 0.95
pendent_tomcat_infoMethod · 0.95

Calls 5

existsMethod · 0.45
ReadFileMethod · 0.45
searchMethod · 0.45
splitMethod · 0.45
groupMethod · 0.45

Tested by

no test coverage detected