/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ #!/usr/bin/env groovy /** ** Sets the classpath before invoking the script that actually uses cTAKES. ** This includes (almost) all jars used by cTAKES as well as the resources ** and descriptors. ** ** This script assumes that you have installed Groovy and ** that you have the command groovy available in your path. ** This also assumes you have installed Apache cTAKES ** from the convenience binary. ** ** Set the following below ** cTAKES_HOME (where you extracted cTAKES. This should be the parent of bin, desc, resources, etc) ** EXTERNAL_RESOURCE_PATH (the parent of ctakes-resources-3.1.0, available from SF.net) ** ** On Debian/Ubuntu systems, installing Groovy should be as easy as apt-get install groovy. ** You can download groovy from http://groovy.codehaus.org/ ** Usage: $groovy run_cTAKES.groovy [inputDir] **/ import java.io.File; println("Starting " + this.class.getName()); // print out the classpath entries for debug purposes //this.class.classLoader.rootLoader.URLs.each{ println it } // TODO improve handling of whether user enters a trailing slash for these two constants: def cTAKES_HOME = "/C:/Apache-cTAKES/apache-ctakes-3.1.1/"; cTAKES_HOME = "/C:/Apps/Apache-cTAKES/3.1.1-from-bin-zip/apache-ctakes-3.1.1/"; def EXTERNAL_RESOURCE_PATH = "/C:/parent-of-ctakes-resources"; EXTERNAL_RESOURCE_PATH = "/C:/usr/data/cTAKES-resources"; println("Using cTAKES in " + cTAKES_HOME); // Add everything under cTAKES lib directory to classpath File jarsDir = new File(cTAKES_HOME, "lib"); File[] files = jarsDir.listFiles(); //for (int i=files.length-1; i>=0; i--) { for (int i=0; i