diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 3d9ed8ac12..504fa716c3 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -24,6 +24,7 @@ as comments are recognized as such and ignored. ### Fixed Issues * all + * [#1272](https://github.com/pmd/pmd/issues/1272): \[core] Could not find or load main class when using symlinked run.sh * [#1377](https://github.com/pmd/pmd/issues/1377): \[core] LanguageRegistry uses default class loader when invoking ServiceLocator * java * [#1330](https://github.com/pmd/pmd/issues/1330): \[java] PMD crashes with java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/xml/ws/Service diff --git a/pmd-dist/src/main/scripts/run.sh b/pmd-dist/src/main/scripts/run.sh index 9a5ce0d3e0..79e4ef609e 100755 --- a/pmd-dist/src/main/scripts/run.sh +++ b/pmd-dist/src/main/scripts/run.sh @@ -61,7 +61,13 @@ java_heapsize_settings() { set_lib_dir() { if [ -z ${LIB_DIR} ]; then - local script_dir=$(dirname "${0}") + # Allow for symlinks to this script + if [ -L $0 ]; then + local script_real_loc=$(readlink "$0") + else + local script_real_loc=$0 + fi + local script_dir=$(dirname "${script_real_loc}") local cwd="${PWD}" cd "${script_dir}/../lib"