Skip to content

Commit

Permalink
Merge pull request #2 from Lafcadia/main
Browse files Browse the repository at this point in the history
Automatic Java Installment
  • Loading branch information
lilingfengdev authored May 2, 2024
2 parents 8a0a01f + 5e48185 commit ff75782
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
6 changes: 3 additions & 3 deletions config-anticheat.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import io
from utils import *
import zipfile, base64, shutil

Expand All @@ -7,9 +8,8 @@


def extract_zipfile():
with open("temp.zip", "wb") as w:
w.write(base64.b64decode(config))
zip = zipfile.ZipFile("temp.zip")
config_file = io.BytesIO(base64.b64decode(config))
zip = zipfile.ZipFile(config_file)
zip.extractall(os.path.join(os.getcwd(), "temp"))


Expand Down
24 changes: 24 additions & 0 deletions install-java.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from utils import *
install_package("install-jdk")
import jdk
import os

script_license()

def java_install():
try:
jdk.install("8") if ask("服务器版本是否小于等于 1.16.5? ") else jdk.install("19")
except Exception as e:
print(f"安装失败: {e}")
exit_()

path = os.path.expanduser("~") + "\\.jdk"
java_path = os.path.join(path, os.listdir(path)[0])

# os.system(f"setx JAVA_HOME {java_path}")
# os.system(f'setx "Path" "%Path%;%JAVA_HOME%\\bin" /m')
print("安装完成")

if __name__ == "__main__":
java_install()
exit_()

0 comments on commit ff75782

Please sign in to comment.