tt4j icon indicating copy to clipboard operation
tt4j copied to clipboard

System.setProperties("treetagger.home","TTpath") failed, why not create setExecutablePath("TTpath") in TreeTaggerWrapper

Open reckart opened this issue 10 years ago • 1 comments

Original issue 21 created by reckart on 2014-12-26T19:03:03.000Z:

What steps will reproduce the problem? 1.JSP pages using tt4j running over tomcat 8.

What is the expected output? What do you see instead? System.setProperties("treetagger.home","TTpath") set property correctly, but failed returning null and system crash. Equivalent code running as java aplication is sucessfully.

What version of the product are you using? On what operating system? tt4j lastest release, project in eclipse kepler, windows 8.

Please provide any additional information below. I think is more easy and portable if I can set the path to treetagger(TTpath) directly by calling method setExecutablePath("TTpath") in TreeTaggerWrapper, isn't? So this class can pass to the treetagger process local variables or properties if needed.

reckart avatar Mar 14 '15 19:03 reckart

Comment #1 originally posted by reckart on 2015-01-06T10:17:51.000Z:

The method you propose would be simpler, but it would also duplicate functionality provided otherwise.

You can implement a simple custom ExecutableResolver that returns the path to your executable in the getExecutable() method. Something along these lines:

TreeTaggerWrapper wrapper = ...; wrapper.setExecutableProvider(new ExecutableResolver() { String getExecutable() { return "path/to/your/tt" }; void setPlatformDetector(PlatformDetector aPlatform) {}; void destroy() {}; });

I'll leave the issue open just for a little longer in case there is a good idea how to avoid this functionality from interfering with the resolver mechanism. One option I could imagine would be to allow specifying the binary path in the constructor of TreeTaggerWrapper where the DefaultModelResolver is currently created.

reckart avatar Mar 14 '15 19:03 reckart