質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Java

Javaは、1995年にサン・マイクロシステムズが開発したプログラミング言語です。表記法はC言語に似ていますが、既存のプログラミング言語の短所を踏まえていちから設計されており、最初からオブジェクト指向性を備えてデザインされています。セキュリティ面が強力であることや、ネットワーク環境での利用に向いていることが特徴です。Javaで作られたソフトウェアは基本的にいかなるプラットフォームでも作動します。

Q&A

0回答

439閲覧

ThreadクラスのgetContextClassLoader()がnullを返す条件

退会済みユーザー

退会済みユーザー

総合スコア0

Java

Javaは、1995年にサン・マイクロシステムズが開発したプログラミング言語です。表記法はC言語に似ていますが、既存のプログラミング言語の短所を踏まえていちから設計されており、最初からオブジェクト指向性を備えてデザインされています。セキュリティ面が強力であることや、ネットワーク環境での利用に向いていることが特徴です。Javaで作られたソフトウェアは基本的にいかなるプラットフォームでも作動します。

0グッド

0クリップ

投稿2018/06/16 14:24

ThreadクラスのgetContextClassLoader()がnullを返す条件を知りたいです。

Java

1/** 2 * Returns the context {@code ClassLoader} for this thread. The context 3 * {@code ClassLoader} is provided by the creator of the thread for use 4 * by code running in this thread when loading classes and resources. 5 * If not {@linkplain #setContextClassLoader set}, the default is the 6 * {@code ClassLoader} context of the parent thread. The context 7 * {@code ClassLoader} of the 8 * primordial thread is typically set to the class loader used to load the 9 * application. 10 * 11 * 12 * @return the context {@code ClassLoader} for this thread, or {@code null} 13 * indicating the system class loader (or, failing that, the 14 * bootstrap class loader) 15 * 16 * @throws SecurityException 17 * if a security manager is present, and the caller's class loader 18 * is not {@code null} and is not the same as or an ancestor of the 19 * context class loader, and the caller does not have the 20 * {@link RuntimePermission}{@code ("getClassLoader")} 21 * 22 * @since 1.2 23 */ 24 @CallerSensitive 25 public ClassLoader getContextClassLoader() { 26 if (contextClassLoader == null) 27 return null; 28 SecurityManager sm = System.getSecurityManager(); 29 if (sm != null) { 30 ClassLoader.checkClassLoaderPermission(contextClassLoader, 31 Reflection.getCallerClass()); 32 } 33 return contextClassLoader; 34 }

こちらはThreadクラスのgetContextClassLoader()です。

javadocを読んでもいまいちピンと来ません。
どなたか教えてくださいませ。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問