I am trying to get Mary TTS working using Java with Eclipse. I have followed the tutorial from here so far https://www.youtube.com/watch?v=OLKxBorVwk8, but when I try to run the Hello World program it gives me the "Cannot start MARY server". My main code can be seen below:
package model;
public class Main {
public static void main(String[] args) {
TextToSpeech tts = new TextToSpeech();
tts.speak("Hello World!", 1.0f, false, false);
}
}
The classes TextToSpeech.java and AudioPlayer.java can be found here and here, respectively.
The few other threads I found on GitHub on this problem seemed to suggest that too many jar files have been packed into the big jar file but I tried with the jar files from the marytts GitHub page and got the same error. Any help is greatly appreciated.
I have the same problem, but to solve it, I only add the following jar in my project.
guava-22.0.jar
marytts-builder-5.2-jar-with-dependencies.jar
marytts-lang-en-5.2.jar
voice-cmu-rms-hsmm-5.2.jar
voice-cmu-slt-hsmm-5.2.jar
voice-dfki-poppy-hsmm-5.2.jar
So I'm trying to write a Java program using the SAP BO SDK. When I try to create a session, using a predefined class from the SDK, I get a nullPointerException. I copied my code 1 to 1 from an SDK tutorial. Here is my code:
public class Program {
public static void main(String[] args) {
try {
ISessionMgr sessionMgr = CrystalEnterprise.getSessionMgr();
...
}
}
}
When I run that code (I commented everything else out for testing), I get the following error:
Exception in thread "main" java.lang.NullPointerException
at com.crystaldecisions.celib.classloader.ClassLoaderHelper$2.getResourceAsStream(ClassLoaderHelper.java:102)
at com.crystaldecisions.celib.classloader.ClassLoaderHelper.getResourceAsStream(ClassLoaderHelper.java:149)
at com.crystaldecisions.sdk.framework.internal.SessionMgr.initializeSystemProperties(SessionMgr.java:258)
at com.crystaldecisions.sdk.framework.internal.SessionMgr.<init>(SessionMgr.java:253)
at com.crystaldecisions.sdk.framework.internal.CEFactory.makeSessionMgr(CEFactory.java:94)
at com.crystaldecisions.sdk.framework.CrystalEnterprise.getSessionMgr_aroundBody0(CrystalEnterprise.java:121)
at com.crystaldecisions.sdk.framework.CrystalEnterprise.getSessionMgr_aroundBody1$advice(CrystalEnterprise.java:512)
at com.crystaldecisions.sdk.framework.CrystalEnterprise.getSessionMgr(CrystalEnterprise.java:1)
at myprogram.main(Program.java:18) <-- Line 4 in my code example above
Does this mean that there is an error in the libraries provided by the SDK? Or that I somehow imported those incorrectly? Is it possible to get any more information from this error code?
Thank you for any help or guidance you can provide.
EDIT: The tutorial used: http://bukhantsov.org/2011/08/getting-started-with-businessobjects-java-sdk/
The issue was that I was referencing JAR files directly from my Program Files. Copying the files to a local folder in my workspace, and referencing them from there fixed the problem.
I am using c dll in java, I want to load c Dll in java, I use JNA library but I get error “Exception in thread "main" java.lang.UnsatisfiedLinkError: The application has failed to start because its side-by-side configuration is incorrect.”, please tell me how can I solve my problem, if you have another solution please guidance me.
import com.sun.jna.Native;
public class ConectorTJna {
public static void main(String args[]) {
IConectorT lib = (IConectorT) Native.loadLibrary("add", IConectorT.class);
int teste=lib.add(4, 5);
System.out.println("RESULT: " + teste);
}
}
You're probably missing some DLL required by your add.dll. Try to check in the Event viewer -> Windows Logs -> Application to see if there is more info in here.
I've seen lots of people asking similar questions to mine but their solutions aren't working for me. Here's what I've got:
I downloaded the latest OpenCV for Windows (2.4.9). I extracted this to C:\opencv-249
I then created a new Maven 3 project in IntelliJ. This works fine and I can run the compile/package goals, etc. I can execute and debug my program. This is all good.
Next, I tried to pull OpenCV into my test app and ended up with the following code:
package com.foo.OpenCVTest;
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.CvType;
/**
* Created by rick on 5/7/2014.
*/
public class RobotCntrl {
static{ System.loadLibrary(Core.NATIVE_LIBRARY_NAME); }
static public void main(String args[]) {
System.out.println("In main!");
System.out.println("Core Lib: " + Core.NATIVE_LIBRARY_NAME);
Mat m = Mat.eye(3, 3, CvType.CV_8UC1);
System.out.println("m = " + m.dump());
}
}
I then added the local OpenCV to my pom.xml:
<dependency>
<groupId>org.opencv</groupId>
<artifactId>opencv</artifactId>
<version>2.4.9</version>
<systemPath>${java.home}/../../../../opencv-249/build/java/opencv-249.jar</systemPath>
<scope>system</scope>
</dependency>
And I added OpenCV as a project library:
And I modified the IntelliJ VM Options (Edit Configurations) to update the java.library.path to point to the OpenCV dlls:
When I run the application appears to load the opencv_java249.dll library just fine (it doesn't complain), but for the line:
Mat m = Mat.eye(3, 3, CvType.CV_8UC1);
It bombs out complaining that it can't find the underlying n_eye() native function:
In main!
Exception in thread "main" java.lang.UnsatisfiedLinkError: org.opencv.core.Mat.n_eye(III)J
Core Lib: opencv_java249
at org.opencv.core.Mat.n_eye(Native Method)
at org.opencv.core.Mat.eye(Mat.java:1467)
at com.aether.Robots.RobotCntrl.main(RobotCntrl.java:25)
Process finished with exit code 1
I'm at a loss now. It's loading the wrapper library but it can't call the dependent functions. For the previous questions on similar issues, it tends to be resolved when people update their java.library.path variable, but mine seems correct:
-Djava.library.path=C:\opencv-249\build\x64\vc10\bin;C:\opencv-249\build\java\x64
or people forget to call System.loadLibrary(), but that call is succeeding (as far as I can tell) for me.
Any ideas?
I need capture a video stream from my USB webcam, for this i use Opencv 2.4.6 for developing in Java. I follow the steps listed in here
I add the "C:\opencv\build\java\x64" dir to my System PATH and include the "opencv-246.jar" file into my libraries on ECLIPSE. When y run the explame
import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
public class Main {
public static void main(String[] args) {
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
Mat m = Mat.eye(3, 3, CvType.CV_8UC1);
System.out.println("m = " + m.dump());
}
}
i get
m = [1, 0, 0;
0, 1, 0;
0, 0, 1]
OK =)
but when i run
import org.opencv.highgui.VideoCapture;
public class Main {
public static void main(String[] args) {
VideoCapture vc = new VideoCapture(0);
if(vc.isOpened()){
System.out.println("Works!");
}
}
}
i get
Exception in thread "main" java.lang.UnsatisfiedLinkError: org.opencv.highgui.VideoCapture.n_VideoCapture(I)J
at org.opencv.highgui.VideoCapture.n_VideoCapture(Native Method)
at org.opencv.highgui.VideoCapture.<init>(VideoCapture.java:113)
at Main.main(Main.java:5)
i add all the routes containes in:
C:\opencv\build\x64\vc10
one by one,but doesn`t work.
Finally i create a variable called OPENCV_DIR with C:\opencv\build\x64\vc10 but still getting UnsatisfiedLinkError.
PLEASE HELP ME!
in your second example , you skipped this line
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
so the opencv libs werent loaded, UnsatisfiedLinkError, etc...
[edit]:
thanks to #Jishnu Prathap for highlighting the java.library path issue, if you run into problems setting that, you can still try to use an absolute path to the java wrapper so/dll/dylib like:
System.load("/path to/our/java_wrapper");
I had a similar error while using OpenCV with java.I did 2 things to resolve it.
static{ System.loadLibrary(Core.NATIVE_LIBRARY_NAME); }
I added the path to OpenCV dll or .so to javalibpath or path. which actually didnt work for some reason and i ended up putting the OpenCV dll in the system32 folder.
Try the below code
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import nu.pattern.OpenCV;
public class OpencvMain
{
public static void main( String[] args )
{
OpenCV.loadLocally();
Mat mat = Mat.eye( 3, 3, CvType.CV_8UC1 );
System.out.println( "mat = " + mat.dump() );
}
}
For general users using opencv3.x:
HighGUI module does not exist anymore in Java for opencv 3.0 and above.
import org.opencv.videoio.VideoCapture;
instead of
import org.opencv.highgui.VideoCapture;
videoio includes VideoCapture, VideoWriter.
Similarly:
imgcodecs includes imread/imwrite and friends
Example:
Highgui.imread(fileName)
-->
Imgcodecs.imread(fileName)
So, I was having this problem too and I did what you all suggested, it worked fine in my x64 windows, but in a x86 couldn't make it work.
At last I found a solution by changing:
VideoCapture capture = new VideoCapture(0);
for
VideoCapture capture = new VideoCapture();
capture.open("resources/vid.MP4");
I don't know why this worked but I hope it may help somebody with my same problem.
I tried a lot of tutorials online for the resolution, only one of them have helped me.
There are two steps that are different in this method,
Firstly, while importing the java project from Opencv SDK into the Android studio, make sure to uncheck all the checkboxes presented in the import dialog.
Secondly, make sure you import the OpenCV.mk file that is in the native/jdk of the SDK..
The System.loadLibrary() seems to return true after this, which was a huge relief for me as it took me several hours to figure this out
Here's the link to the tutorial that helped me
https://medium.com/#rdeep/android-opencv-integration-without-opencv-manager-c259ef14e73b