Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JNLP - Web - Freetts, Eclipse, and Runnable Jar File  RSS feed

 
Matthew Morrow
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

How do you incorporate Freetts into a java application and export that SINGLE jar file using Eclipse?

I incorporated Freetts into my DBMS Java application in order for the hearing impaired to be able to use it (my DBMS application, that is).
I've successfully used this Freetts augmentation for many, many years.
Now, I'd like to have it Web accessible using JNLP and I would like to be able to use a single signed-jar file (instead of my DBMS jar file and the Freetts jar files in the lib subdirectory).
So, I am trying to use Eclipse and the Export/Runnable-jar-file capability.
I've tried both options:

Extract required libraries into generated JAR
Package required libraries into generated JAR

But I get the errors below whether I use 'Extract' or 'Package'.
They are spurious errors because the application executes just fine when I don't export it to a runnable jar file; and I use 'java -jar' and the 'lib' sub-directory.
IOW, both my code and my environment are just fine - whether I build it using NetBeans, Eclipse or even ant/make.
It's just that trying to get a single jar file seems to be the issue.
Trying to execute the runnable-jar file:

./My_DB.jar
No synthesizer created. This may be the result of any
number of problems. It's typically due to a missing
"speech.properties" file that should be at either of
these locations:

user.home : /home/matthew
java.home/lib: /usr/bin/jdk1.8.0_60/jre/lib

Another cause of this problem might be corrupt or missing
voice jar files in the freetts lib directory. This problem
also sometimes arises when the freetts.jar file is corrupt
or missing. Sorry about that. Please check for these
various conditions and then try again.
Trying to execute the single jar file the conventional way (even though it's supposed to be runnable):

java -jar ./My_DB.jar
No synthesizer created. This may be the result of any
number of problems. It's typically due to a missing
"speech.properties" file that should be at either of
these locations:

user.home : /home/matthew
java.home/lib: /usr/bin/jdk1.8.0_60/jre/lib

Another cause of this problem might be corrupt or missing
voice jar files in the freetts lib directory. This problem
also sometimes arises when the freetts.jar file is corrupt
or missing. Sorry about that. Please check for these
various conditions and then try again.
Here's my speech.properties files (and again, these work just fine using the Freetts 'lib' sub-directory):

ls -lisa /usr/bin/jdk1.8.0_60/jre/lib/speech.properties
20059372 4 -rw-r--r-- 1 root root 425 Oct 5 09:53 /usr/bin/jdk1.8.0_60/jre/lib/speech.properties

^lib/s^s
ls -lisa /usr/bin/jdk1.8.0_60/jre/speech.properties
20058944 4 -rwxr-xr-x 1 root root 425 Oct 5 10:07 /usr/bin/jdk1.8.0_60/jre/speech.properties

ls -lisa /home/matthew/speech.properties
2885497 4 -rw-rw-r-- 1 matthew matthew 425 Jul 31 19:30 /home/matthew/speech.properties

TIA,
Matt
 
Tim Holloway
Bartender
Posts: 18705
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You tried various IDEs, Ant, and Make. But apparently you missed Maven!

Maven has a plugin that produces executable JARs and can be invoked from an IDE or the command line. It's quite useful. Although I think that there should have been a way to use Ant to do this as well. I just don't use Ant that much these days.

When you're trying to bundle multiple libraries into a single executable JAR, there are basically 2 options:

1. Explode all the library jars, merge the resulting directories with your own class directory, then JAR up the whole thing as one big JAR. This can be a bit untidy because everything gets scrambled together.

2. Incorporate the library jars as elements within the executable JAR in the same way that the WEB-INF/lib directory works for J2EE WARs. Since the default Java runtime classpath does not descend into sub-jars, a custom classloader has to be integrated into the app to be able to search and fetch classes within these sub-jars, and I think it's automatically wired into the executable JAR by the Maven plugin. I wrote such a custom classloader once myself, but it was for a special and now obsolete environment. It wasn't as hard as you might think! But the Maven executable JAR plugin handles that for you, so you don't have to.
 
Matthew Morrow
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Great. Thanks a bunch. I'll give Maven a shot.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!