public static File getSourceLocationForClass(Class<?> classObject) {
		String name = classObject.getName().replace('.', '/') + ".class";
		URL url = classObject.getClassLoader().getResource(name);

		String urlFile = url.getFile();
		try {
			urlFile = URLDecoder.decode(urlFile, "UTF-8");
		}
		catch (UnsupportedEncodingException e) {
			// can't happen, since we know the encoding is correct
		}

		if ("file".equals(url.getProtocol())) {
			int packageLevel = getPackageLevel(classObject);
			File file = new File(urlFile);
			for (int i = 0; i < packageLevel + 1; i++) {
				file = file.getParentFile();
			}
			return file;
		}

		if ("jar".equals(url.getProtocol())) {
			// Running from Jar file
			String jarPath = urlFile;
			if (!jarPath.startsWith("file:")) {
				return null;
			}

			// strip off the 'file:' prefix and the jar path suffix after the
			// '!'
			jarPath = jarPath.substring(5, jarPath.indexOf('!'));
			return new File(jarPath);
		}

		return null;
	}
Returns a file that contains the given class. If the class is in a jar file, then
the jar file will be returned. If the file is in a .class file, then the directory
containing the package root will be returned (i.e. the "bin" directory).

@param classObject the class for which to get the location
@return the containing location
Ghidra/Framework/Utility/src/main/java/ghidra/util/SystemUtilities.java