java

package
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoJDKConfigured = errors.New("no JDK configured")

Functions

func AddJDK

func AddJDK(name, path string) error

AddJDK 添加新的 JDK

func GetCurrentJDK

func GetCurrentJDK() (config2.JDK, error)

GetCurrentJDK 获取当前使用的 JDK

func Init

func Init(sdkType string) error

*

*1.  init config.json, backup.json
*2.  set env : JAVA_HOME and Path

func init() { cfg, _ = config2.GetInstance()

if err != nil {
	return fmt.Errorf("加载配置失败: %v", err)
}

Init() }

func ListJdks

func ListJdks() (map[string]config2.JDK, error)

ListJdks 返回所有已注册的 Java JDK

func RemoveJDK

func RemoveJDK(name string) error

RemoveJDK 移除 JDK

func UseJDK

func UseJDK(name string) error

UseJDK 设置当前使用的 JDK

Types

type JDK

type JDK struct {
	Name string
	Path string
}

func ScanJDK

func ScanJDK(dir string) []JDK

ScanJDK 是一个简单的包装器,只返回找到的JDK列表

type ScanResult

type ScanResult struct {
	JDKs     []JDK
	Duration time.Duration
	Scanned  int // 实际扫描的目录数
	Skipped  int // 因权限等问题跳过的目录数
	Excluded int // 因已存在或规则被排除的目录数
}

ScanResult 包含扫描操作的详细结果

func ScanJDKWithStats

func ScanJDKWithStats(dir string) ScanResult

ScanJDKWithStats 使用健壮的并发模型执行JDK扫描并返回详细统计信息

type WorkerResult

type WorkerResult struct {
	FoundJDK    *JDK
	SubDirTasks []WorkerTask
	IsSkipped   bool
	IsExcluded  bool
}

WorkerResult 是工人完成任务后返回的结果

type WorkerTask

type WorkerTask struct {
	Path  string
	Depth int
}

Task 定义了需要扫描的目录任务

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL