Skip to content

Instantly share code, notes, and snippets.

@shyiko
Created November 12, 2011 09:27
Show Gist options
  • Save shyiko/1360291 to your computer and use it in GitHub Desktop.
Save shyiko/1360291 to your computer and use it in GitHub Desktop.
JD-GUI Launcher for Intellij IDEA (via External Tools)
#!/bin/bash
JDGUI_BIN=$1; FILE_PATH=$2
DELIMITER_INDEX=$(awk -v a="$FILE_PATH" -v b="!/" 'BEGIN{print index(a,b)}')
if [ $DELIMITER_INDEX -eq 0 ]; then
$JDGUI_BIN $FILE_PATH
else
JAR_FILE=${FILE_PATH:0:$DELIMITER_INDEX-1}
CLASS_RELATIVE_LOCATION=${FILE_PATH:$DELIMITER_INDEX+1}
if [[ $CLASS_RELATIVE_LOCATION == "" ]]; then
$JDGUI_BIN $JAR_FILE
else
TEMPORARY_DIR=$(mktemp -d)
cd $TEMPORARY_DIR
unzip -u $JAR_FILE $CLASS_RELATIVE_LOCATION
$JDGUI_BIN $CLASS_RELATIVE_LOCATION
fi
fi
@shyiko
Copy link
Author

shyiko commented Nov 12, 2011

IDE Settings -> External Tools -> Add...

  • Name: Open with JD-GUI
  • Group: External Tools
  • Program: <env_specific_path>/intellij-idea-jd-gui-launcher.sh
  • Parameters: <env_specific_path>/jd-gui $FilePath$

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment