alishia / tt4j

Automatically exported from code.google.com/p/tt4j
0 stars 0 forks source link

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

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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.

Original issue reported on code.google.com by renatoco...@gmail.com on 26 Dec 2014 at 7:03

GoogleCodeExporter commented 9 years ago
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.

Original comment by richard.eckart on 6 Jan 2015 at 10:17