JVM学习笔记25——Launcher类源码分析

本文介绍了Java中的系统类加载器(SystemClassLoader),它是默认的委托父加载器,用于启动应用程序。系统类加载器通常是一个实现依赖的ClassLoader实例。当此方法首次调用时,如果设置了'java.system.class.loader'系统属性,那么该属性指定的类将被加载,并作为系统类加载器的父加载器。这个过程涉及创建指定类的实例,该类必须有一个接受ClassLoader参数的公共构造器。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

public static ClassLoader getSystemClassLoader()


Returns the system class loader for delegation. This is the default delegation parent for new ClassLoader instances, and is typically the class loader used to start the application.
This method is first invoked early in the runtime's startup sequence, at which point it creates the system class loader and sets it as the context class loader of the invoking Thread.

The default system class loader is an implementation-dependent instance of this class.
If the system property "java.system.class.loader" is defined when this method is first invoked then the value of that property is taken to be the name of a class that will be returned as the system class loader. The class is loaded using the default system class loader and must define a public constructor that takes a single parameter of type ClassLoader which is used as the delegation parent. An instance is then created using this constructor with the default system class loader as the parameter. The resulting class loader is defined to be the system class loader.

浏览源代码网站:grepcode.com

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值