diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9d0b71a --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +build +dist diff --git a/README b/README index 9d5b1ec..b403d80 100644 --- a/README +++ b/README @@ -6,4 +6,8 @@ client programs to join. When running as the server a local client is created to connect to it. -------------------------------------------------------------------------------- Code in this project is licensed under the GNU GENERAL PUBLIC LICENSE -http://www.gnu.org/licenses/gpl.txt \ No newline at end of file +http://www.gnu.org/licenses/gpl.txt + +Written by Chris Hallson and originally found here: https://github.com/DrLabman/JavaChat +Only slight modification to suit my environment. And handle one exception (could not run +without whatismyip.com). diff --git a/src/javachat/network/util/IPUtil.java b/src/javachat/network/util/IPUtil.java index 2545011..09ddd0e 100644 --- a/src/javachat/network/util/IPUtil.java +++ b/src/javachat/network/util/IPUtil.java @@ -39,7 +39,7 @@ public static String getExternalIPAddress(){ return in.readLine(); //you get the IP as a String } catch (IOException ex) { } finally { - try { in.close(); } catch (IOException ex) {} + try { in.close(); } catch (Exception ex) {} } return null; } diff --git a/start-chat.sh b/start-chat.sh new file mode 100644 index 0000000..7e37e89 --- /dev/null +++ b/start-chat.sh @@ -0,0 +1,60 @@ +#! /bin/sh +# + +## make sure JavaChat is ready +if [ -z "$CHAT_HOME" ] +then + CHAT_HOME=`dirname $0` +fi + +if [ ! -f $CHAT_HOME/dist/JavaChat.jar ] +then + echo 'ERROR: JavaChat library not found (project not built?)' 1>&2 + exit 1 +fi + +## configure java cmdline for JavaChat + +# classpath + no other jvm options + main class +if [ -z "$CLASSPATH" ] +then + CLASSPATH="$CHAT_HOME/dist/JavaChat.jar:$CHAT_HOME/lib/*" +else + CLASSPATH="$CHAT_HOME/dist/JavaChat.jar:$CHAT_HOME/lib/*:$CLASSPATH" +fi +CHAT_OPTS= +CHAT_ARGS=javachat.JavaChat + +#### include gumshoe? + +if [ "x$1" = x--gumshoe ] +then + ## make sure gumshoe is ready + if [ -z "$GUMSHOE_HOME" ] + then + echo ERROR: GUMSHOE_HOME environment variable is not set 1>&2 + exit 1 + fi + if [ ! -f $GUMSHOE_HOME/gumshoe-probes/target/gumshoe-probes-0.1.0-SNAPSHOT.jar -o \ + ! -f $GUMSHOE_HOME/gumshoe-tools/target/gumshoe-tools-0.1.0-SNAPSHOT.jar ] + then + echo 'ERROR: gumshoe libraries not found (GUMSHOE_HOME wrong value or project not built?)' 1>&2 + exit 1 + fi + + ## update java cmdline for gumshoe + + # add gumshoe probe (data collection/filtering) and tool (gui) libs to classpath + CLASSPATH="$CLASSPATH:$GUMSHOE_HOME/gumshoe-probes/target/gumshoe-probes-0.1.0-SNAPSHOT.jar" + CLASSPATH="$CLASSPATH:$GUMSHOE_HOME/gumshoe-tools/target/gumshoe-tools-0.1.0-SNAPSHOT.jar" + # add tiny hook to JVM + CHAT_OPTS="$CHAT_OPTS -Xbootclasspath/p:$GUMSHOE_HOME/gumshoe-hooks/target/gumshoe-hooks-0.1.0-SNAPSHOT.jar" + # makes a better demo if we report faster (30s) and don't trim the stack + CHAT_OPTS="$CHAT_OPTS -Dgumshoe.socket-io.period=30000" + CHAT_OPTS="$CHAT_OPTS -Dgumshoe.socket-io.exclude=" + # gumshoe becomes "main" + CHAT_ARGS="com.dell.gumshoe.tools.Gumshoe $CHAT_ARGS" +fi + +## run it +java -classpath "$CLASSPATH" $CHAT_OPTS $CHAT_ARGS