{Cannot run program "octave"} in Windows Eclipse - eclipse

Peace be upon you,
In the following page, a user had a problem in executing his JavaOctave code (my problem is similar to his)
https://kenai.com/projects/javaoctave/lists/general-discussion/archive/2009-12/message/1
I saw that the JavaOctave responsible has spoken about "Configuring the PATH variable to include a path to Octave". But I do not have access to any "Octave.class" file (in their site download part it seems that there is no access to *.class files) so I cannot set the path for pointing out to that object; also, when I set the path to ";...\backups" (the folder containing the "javaoctave-0.6.4.jar"), my problem would not be solved and again I receive
Exception in thread "main" dk.ange.octave.exception.OctaveIOException: java.io.IOException: Cannot run program "octave": CreateProcess error=2, The system cannot find the file specified
at dk.ange.octave.exec.OctaveExec.<init>(OctaveExec.java:102)
at dk.ange.octave.OctaveEngine.<init>(OctaveEngine.java:65)
at dk.ange.octave.OctaveEngineFactory.getScriptEngine(OctaveEngineFactory.java:49)
at edu.udg.agentlab.moviervkb.Test.main(Test.java:12)
Caused by: java.io.IOException: Cannot run program "octave": CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at dk.ange.octave.exec.OctaveExec.<init>(OctaveExec.java:100)
... 3 more
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 6 more
I also used the suggestion in this question:
javaoctave jar file has failed in Mac OSX Eclipse
but it couldn't help me and a similar error repeated (the asked question was not occurred in Windows):
Exception in thread "main" dk.ange.octave.exception.OctaveIOException: java.io.IOException: Cannot run program "path_to_octave_executable": CreateProcess error=2, The system cannot find the file specified
Can anyone help me run my JavaOctave program in my editor (Eclipse) or in any other editor?

But I do not have access to any "Octave.class"
The mentioned link is not about a *.class file, but some kind of binary for the Windows function CreateProcess. You need some kind of binary and make that available using either PATH in your Eclipse run configuration or to your user in general or whatever. That's surely your real problem, that you are either missing an *.exe or that's CreateProcess can*t find it. You can read the documentation for CreateProcess where it looks for binaries.
CreateProcess in the MSDN

Related

I'm trying to run a java file that reads in a text file in the same directory but it says the file isn't found

I'm trying to run a java class that reads in a txt file and even though the text file is in the exact same folder as the class, it says it can't find it. the exact error is
"Exception in thread "main" java.io.FileNotFoundException: Employees.txt (No such file or directory)"

Google OR tools

I am learning to solve some optimisation programs using google or-tools.
I started with their example code and I an trying to run it in intellij.
But when I write the code and compile I get the following error.
Exception in thread "main" java.lang.UnsatisfiedLinkError: com.google.ortools.linearsolver.operations_research_linear_solverJNI.MPSolver_CLP_LINEAR_PROGRAMMING_get()I
at com.google.ortools.linearsolver.operations_research_linear_solverJNI.MPSolver_CLP_LINEAR_PROGRAMMING_get(Native Method)
at com.google.ortools.linearsolver.MPSolver$OptimizationProblemType.<clinit>(MPSolver.java:221)
I searched for some answers and I found that it requires jniortools.dll .
But I am working with ubuntu. Hence i assume i need to load the libjniortools.so file , am I right?.
So I included the line
static {
System.loadLibrary("libjniortools");
}
and I have a lib folder wherein I have put both com.google.ortools.jar and protobuf.jar along with all the other lib files that were present when I extracted the zip file(basically copy pasted the lib folder from extracted zip file).
I have added the jar paths in intellij as shown in figure
enter image description here
*the last 2 line of dependency in image
Then I have also tried giving the lib path in VM-options:
-Djava.library.path=/home/surajvashistha/IdeaProjects/LPModel/lib
After all this, I get the following error
Exception in thread "main" java.lang.UnsatisfiedLinkError: no libjniortools in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1860)
at java.lang.Runtime.loadLibrary0(Runtime.java:871)
at java.lang.System.loadLibrary(System.java:1124)
at LP.<clinit>
I am stuck here and not able to move forward. Can anyone help?

How to add DLLs while building a JAR - Eclipse

I have made an OCR Application that would convert image files to Doc Files, using Tesseract as its OCR Engine. I used the Tess4j JNA Wrappers for this. While making the application i put the dll files and the language data(tessdata) in the bin folder of the project, and the application worked fine.
Now when i build the project the dll files and tessdata are not included in the JAR, and thus the program isn't working.
I have tried two ways of export
**1. Package Required Libraries into Generated JAR **
I added the DLL files & the Tessdata in the same directory as the JAR file. But it didnt run.
http://i.imgur.com/cGwiVFC.png
It gave me the following Error
F:\New folder>java -jar w.jar scan.jpg
Error opening data file bin//tessdata/eng.traineddata
Please make sure the TESSDATA_PREFIX environment variable is set to the parent d
irectory of your "tessdata" directory.
Failed loading language 'eng'
Tesseract couldn't load any languages!
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoa
der.java:58)
Caused by: java.util.ServiceConfigurationError: javax.imageio.spi.ImageInputStre
amSpi: Provider com.sun.media.imageioimpl.stream.ChannelImageInputStreamSpi coul
d not be instantiated: java.lang.IllegalArgumentException: vendorName == null!
at java.util.ServiceLoader.fail(ServiceLoader.java:224)
at java.util.ServiceLoader.access$100(ServiceLoader.java:181)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:377)
at java.util.ServiceLoader$1.next(ServiceLoader.java:445)
at javax.imageio.spi.IIORegistry.registerApplicationClasspathSpis(IIOReg
istry.java:210)
at javax.imageio.spi.IIORegistry.<init>(IIORegistry.java:138)
at javax.imageio.spi.IIORegistry.getDefaultInstance(IIORegistry.java:159
)
at javax.imageio.ImageIO.<clinit>(ImageIO.java:65)
at net.sourceforge.vietocr.ImageIOHelper.getImageByteBuffer(Unknown Sour
ce)
at net.sourceforge.tess4j.Tesseract.setImage(Unknown Source)
at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)
at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)
at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)
at com.shaurya.back.OCR.TesseractEngine.getResult(TesseractEngine.java:2
0)
at com.shaurya.back.ImageToDocument.identify(ImageToDocument.java:117)
at com.shaurya.back.ImageToDocument.transform(ImageToDocument.java:53)
at com.shaurya.front.runnow.main(runnow.java:27)
... 5 more
Caused by: java.lang.IllegalArgumentException: vendorName == null!
at javax.imageio.spi.IIOServiceProvider.<init>(IIOServiceProvider.java:7
6)
at javax.imageio.spi.ImageInputStreamSpi.<init>(ImageInputStreamSpi.java
:90)
at com.sun.media.imageioimpl.stream.ChannelImageInputStreamSpi.<init>(Ch
annelImageInputStreamSpi.java:63)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
orAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at java.lang.Class.newInstance(Class.java:374)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:373)
... 19 more
F:\New folder>
**2. Copy Required Libraries in Sub-Folder next to the generated JAR **
Here too i copied the dll files and the tessdata folder in the same directory as the JAR Files.(If i copy it inside the subfolder containing libraries, it couldn't even find the DLL files.)
http://i.imgur.com/7ShF3Ev.png
The error given is:
F:\New folder\kol>java -jar runn.jar scan.jpg
Error opening data file bin//tessdata/eng.traineddata
Please make sure the TESSDATA_PREFIX environment variable is set to the parent d
irectory of your "tessdata" directory.
Failed loading language 'eng'
Tesseract couldn't load any languages!
Exception in thread "main" java.lang.Error: Invalid memory access
at com.sun.jna.Native.invokePointer(Native Method)
at com.sun.jna.Function.invokePointer(Function.java:470)
at com.sun.jna.Function.invoke(Function.java:404)
at com.sun.jna.Function.invoke(Function.java:315)
at com.sun.jna.Library$Handler.invoke(Library.java:212)
at com.sun.proxy.$Proxy0.TessBaseAPIGetUTF8Text(Unknown Source)
at net.sourceforge.tess4j.Tesseract.getOCRText(Unknown Source)
at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)
at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)
at net.sourceforge.tess4j.Tesseract.doOCR(Unknown Source)
at com.shaurya.back.OCR.TesseractEngine.getResult(TesseractEngine.java:2
0)
at com.shaurya.back.ImageToDocument.identify(ImageToDocument.java:117)
at com.shaurya.back.ImageToDocument.transform(ImageToDocument.java:53)
at com.shaurya.front.runnow.main(runnow.java:27)
F:\New folder\kol>
So the Main problem it seems is that it isnt abke to find the Tessdata folder, though the dll are found. Another thing i was curious about is why is there a bit of change in Exception Stack in both cases(This seems unusual since both have the same code and are facing the same problem, just that the packaging is done a bit different.)
EDIT 1:
It Doesn't work even if i remove the dlls and tessdata from the bin to another folder and add it as an external class folder in the Java Build Path -> Libraries. If i do that then i get the same error that tessdata isnt found(In the application itself).
EDIT 2:
instance.setDatapath("bin//tessdata");
This is what is set as my datapath. Maybe changing this in someway might fix the error?
And Sorry if there has been some formatting problems in the post. The StackOverflow Ask a question isnt showing any preview or doesnt have the formatting buttons right now. Will Edit it if there are problems later when it does show :)
-Shaurya
It looks that it could not locate the tessdata folder under bin. Do you have it under there? The double forward slashes also look suspect; try to change it to "bin/".

Missing sbt/boot/ directory in new play-2.1.1 installation. Playframework installation on Linux Mint 14

I'm trying to install the Play! Framework on a Linux Mint box, but I'm having a hard time getting play going. After the installation, I'm getting folliwing error message when I type play help at the command line:
$ play help
java.io.FileNotFoundException: /home/play-2.1.1/framework/sbt/boot/update.log (No such file or directory)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:218)
at java.io.FileOutputStream.<init>(FileOutputStream.java:171)
at java.io.FileWriter.<init>(FileWriter.java:90)
at xsbt.boot.Update.<init>(Checks.java:51)
at xsbt.boot.Launch.update(Launch.scala:275)
at xsbt.boot.Launch$$anonfun$jnaLoader$1.apply(Launch.scala:120)
at scala.Option.getOrElse(Option.scala:108)
at xsbt.boot.Launch.jnaLoader$2f324eef(Launch.scala:115)
at xsbt.boot.Launch.<init>(Launch.scala:94)
at xsbt.boot.Launcher$.apply(Launch.scala:290)
at xsbt.boot.Launch$.apply(Launch.scala:16)
at xsbt.boot.Boot$.runImpl(Boot.scala:31)
at xsbt.boot.Boot$.main(Boot.scala:20)
at xsbt.boot.Boot.main(Boot.scala)
Error during sbt execution: java.io.FileNotFoundException: /home/play-2.1.1/framework/sbt/boot/update.log (No such file or directory)
As can be seen, play is installed in the /home directory. Content of .bashrc file is as follows:
$ cat ~/.bashrc
export PATH=""/home/play-2.1.1:$PATH""
export JAVA_HOME=/usr/local/java/jdk1.7.0_12
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=$JAVA_HOME/lib/dt.jar:.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/jre/lib/rt.jar
I wonder if I've left out something during the installation process that accounts for the difficulty in getting play up and running. Will appreciate helpfull hints and advise. Many thanks.
Make sure you have write permissions on the Play framework path. You will get this error if you do not.

Error reading manifest file "...datanucleus-core-3.0.0-release.jar!/plugin.xml"

I got a very strange error. This what I've done:
I create a project (with Netbeans) which include datanucleuse-core-3.0.0-release.jar. The project can be built successfully. It also ran smoothly when I tried to run it with Netbeans or running 'java -jar <.jar bundle>' in dist folder via command prompt.
The problem is, when I copy that dist folder into another location and tried to run it again with command prompt, it gave these errors:
Exception in thread "main" Error reading manifest file
"jar:file:/E:/!new/BTJ/NCRServer/lib/datanucleus-core-3.0.0-release.jar!/plugin.xml"
org.datanucleus.exceptions.NucleusException: Error reading manifest
file "jar:fi
le:/E:/!new/BTJ/NCRServer/lib/datanucleus-core-3.0.0-release.jar!/plugin.xml"
at org.datanucleus.plugin.NonManagedPluginRegistry.registerBundle(NonMan
agedPluginRegistry.java:481)
at org.datanucleus.plugin.NonManagedPluginRegistry.registerExtensions(No
nManagedPluginRegistry.java:219)
at org.datanucleus.plugin.NonManagedPluginRegistry.registerExtensionPoin
ts(NonManagedPluginRegistry.java:160)
at org.datanucleus.plugin.PluginManager.(PluginManager.java:62)
at org.datanucleus.NucleusContext.(NucleusContext.java:211)
at org.datanucleus.NucleusContext.(NucleusContext.java:166)
at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.(JDOPersis
tenceManagerFactory.java:360)
at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.createPersistenc
eManagerFactory(JDOPersistenceManagerFactory.java:290)
at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.getPersistenceMa
nagerFactory(JDOPersistenceManagerFactory.java:191)
at com.ncr.server.Server.(Server.java:68)
at com.ncr.server.Server.main(Server.java:91) Caused by: java.io.FileNotFoundException: E:\ (The system cannot find the path s
pecified)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(ZipFile.java:114)
at java.util.jar.JarFile.(JarFile.java:135)
at java.util.jar.JarFile.(JarFile.java:99)
at org.datanucleus.plugin.NonManagedPluginRegistry.registerBundle(NonMan
agedPluginRegistry.java:390)
... 10 more Nested Throwables StackTrace: java.io.FileNotFoundException: E:\ (The system cannot find the path
specified)
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.(ZipFile.java:114)
at java.util.jar.JarFile.(JarFile.java:135)
at java.util.jar.JarFile.(JarFile.java:99)
at org.datanucleus.plugin.NonManagedPluginRegistry.registerBundle(NonMan
agedPluginRegistry.java:390)
at org.datanucleus.plugin.NonManagedPluginRegistry.registerExtensions(No
nManagedPluginRegistry.java:219)
at org.datanucleus.plugin.NonManagedPluginRegistry.registerExtensionPoin
ts(NonManagedPluginRegistry.java:160)
at org.datanucleus.plugin.PluginManager.(PluginManager.java:62)
at org.datanucleus.NucleusContext.(NucleusContext.java:211)
at org.datanucleus.NucleusContext.(NucleusContext.java:166)
at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.(JDOPersis
tenceManagerFactory.java:360)
at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.createPersistenc
eManagerFactory(JDOPersistenceManagerFactory.java:290)
at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.getPersistenceMa
nagerFactory(JDOPersistenceManagerFactory.java:191)
at com.ncr.server.Server.(Server.java:68)
at com.ncr.server.Server.main(Server.java:91)
Anybody got clue ?
I am really sorry for everyone, especially for datanucleus members in StackOverflow.
Apparently the problem is me, not the netbeans, datanucleus API, nor anyone.
As you can see from "jar:file:/E:/!new/BTJ/NCRServer/lib/datanucleus-core-3.0.0-release.jar!/plugin.xml", I put the "dist" folder from Netbeans in "E:/!new" folder. I don't know why but the "!new" folder seems to cause the extra exclamation mark(!) in "release.jar!".
I move the dist folder into D:/ and it worked !!
So, if anyone ever experience this problem (precedence a folder's name with exclamation mark and accidentally put a project with datanucleus-core-3.0.0-release.jar inside it), that's the solution.
Thank you.