Javaで現在実行中のクラスのパッケージや、ディレクトリを取得する。 例えば「Sample」プロジェクトのパッケージ「com.sample.foo.bar.baz」にある以下のようなクラスの場合。 package com.sample.foo.bar.baz; import java.io.File; public class GetCurrentPath { /** カレントパッケージ */ private static final String CURRENT_PACKAGE = GetCurrentPath.class.getPackage().getName(); /** カレントディレクトリ */ private static final String CURRENT_PATH = new File("").getAbsolutePath(); public static voi