#!/bin/bash

# notes: a script for launching OME Notes

# Required JARs: loci_tools.jar, ome-notes.jar

# JAR libraries must be in the same directory as this
# command line script for the command to function.

# If you are a developer working from source and have
# the LOCI classes in your CLASSPATH, you can set the
# LOCI_DEVEL environment variable to use them instead.

PROG=loci.ome.notes.Notes
DIR=`dirname "$0"`

if [ $LOCI_DEVEL ]
then
  java -mx512m $PROG "$@"
elif \
  ([ -e "$DIR/loci_tools.jar" ] || [ -e "$DIR/bio-formats.jar" ]) && \
  [ -e "$DIR/ome-notes.jar" ]
then
  java -mx512m -cp "$DIR":"$DIR/bio-formats.jar":"$DIR/loci_tools.jar":"$DIR/ome-notes.jar" $PROG "$@"
else
  echo "Required JAR libraries not found. Please download:"
  echo "  loci_tools.jar"
  echo "from:"
  echo "  http://www.loci.wisc.edu/bio-formats/downloads"
  echo "as well as the OME Notes JAR from:"
  echo "  http://www.loci.wisc.edu/software/daily/ome-notes.jar"
  echo "and place in the same directory as the command line tools."
  echo ""
  echo "Please note that OME Notes is legacy software that "
  echo "has been discontinued. Use at your own risk."
fi
