{"id":23087644,"url":"https://github.com/exp-codes/jvm-agent","last_synced_at":"2025-04-03T16:45:30.447Z","repository":{"id":57719172,"uuid":"225390073","full_name":"EXP-Codes/jvm-agent","owner":"EXP-Codes","description":"JVM 实例代理","archived":false,"fork":false,"pushed_at":"2022-03-09T15:43:28.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-09T05:27:38.346Z","etag":null,"topics":["javaagent","programming"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/EXP-Codes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-02T14:11:04.000Z","updated_at":"2023-05-04T05:26:59.000Z","dependencies_parsed_at":"2022-08-26T09:41:33.632Z","dependency_job_id":null,"html_url":"https://github.com/EXP-Codes/jvm-agent","commit_stats":null,"previous_names":["lyy289065406/jvm-agent"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EXP-Codes%2Fjvm-agent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EXP-Codes%2Fjvm-agent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EXP-Codes%2Fjvm-agent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/EXP-Codes%2Fjvm-agent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/EXP-Codes","download_url":"https://codeload.github.com/EXP-Codes/jvm-agent/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247043167,"owners_count":20874084,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javaagent","programming"],"created_at":"2024-12-16T19:59:30.855Z","updated_at":"2025-04-03T16:45:30.427Z","avatar_url":"https://github.com/EXP-Codes.png","language":"Java","readme":"# jvm-agent\n\n\u003e JVM 实例代理\n\n------\n\n## 简介 \n\n`-javaagent` 是 java 命令的一个参数。参数 `-javaagent` 可以用于指定一个 jar 包，并且对该 java 包有 2 个要求：\n\n- 这个 jar 包的 `MANIFEST.MF` 文件必须指定 `Premain-Class` 项。\n- `Premain-Class` 指定的那个类必须实现 `premain()` 方法。\n\n`premain()` 方法，从字面上理解，就是运行在 `main()` 函数之前的的类。\n\n当 Java 虚拟机启动时，在执行 `main()` 函数之前，JVM 会先运行 `-javaagent` 所指定 jar 包内 `Premain-Class` 这个类的 `premain()` 方法 。\n\n该包提供了一些工具帮助开发人员在 Java 程序运行时，动态修改系统中的 Class 类型。\n\n\n\u003e 参考文章：《[JavaAgent 使用指南](https://www.cnblogs.com/rickiyang/p/11368932.html)》\n\n\n## 使用方式\n\nmaven 的 `settings.yml` 配置 sonatype 中央仓库：\n\n```xml\n\u003cmirror\u003e\n    \u003cid\u003emvnrepository\u003c/id\u003e\n    \u003cmirrorOf\u003emvnrepository\u003c/mirrorOf\u003e\n    \u003curl\u003ehttp://mvnrepository.com/\u003c/url\u003e\n\u003c/mirror\u003e\n\n\u003cmirror\u003e\n    \u003cid\u003esonatype\u003c/id\u003e\n    \u003cmirrorOf\u003esonatype\u003c/mirrorOf\u003e\n    \u003curl\u003ehttps://s01.oss.sonatype.org/\u003c/url\u003e\n\u003c/mirror\u003e\n```\n\n项目的 `pom.xml` 配置构件坐标：\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.exp-blog\u003c/groupId\u003e\n    \u003cartifactId\u003ejvm-agent\u003c/artifactId\u003e\n    \u003cversion\u003e1.0.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexp-codes%2Fjvm-agent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fexp-codes%2Fjvm-agent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fexp-codes%2Fjvm-agent/lists"}