I am using Tess4J JNA wrapper and I want its console output to appear in a logfile (any kind of text file).
tessInstance.setTessVariable("debug_file", "tesseract.log");
also I have a file called "logfile" in tessdata/configs/ with the following text:
debug_file tesseract.log
The result was simply Tesseract console outputs disappear, but no tesseract.log file.
I did these according to Tesseract-OCR's FAQ.
Tess4J does not have any documentation on how to properly set this in code. I couldn't even find a list of variables, but currently I am only interested in how to put console outputs of Tess4J into a text file through code.
EDIT: The following line of code will make the Tesseract's output disappear from console but the .log file has nothing in it and can't be deleted until the program is shut down.
That statement alone should suffice. Look for the file in your project's root directory. You can specify an absolute path, e.g., "C:\\Temp\\tesseract.log", if desired.
Related
so I'm trying to run my program and I keep getting the error when I run my main class it says that given property file isn't found, below are two images of the file location and the arguments I've putten in and the error that appears, I'm struggling to realize why the file isn't being located, any help?
Because Windows in its wisdom thinks that hiding extensions of known file types is a good ting. You files is called input_parameters.prp and inputs.in, I guess.
If you give those names it would probably find this files.
To be sure you can open a cmd or powershell windows and run the dir command in that folder to see the complete names.
I need to write a program that asks for the file name of a text document of number and then calculates average, median, etc., from this data set. I have written the program so that runs correctly when I input the full path such as "C:\Users\COSC\Documents\inputValues2.txt", however it will not run when I simply input inputValues2.txt. I have been researching the different between the two but am not fully understanding how to fix this. Since it is running correctly, otherwise, I don't believe it is a problem with the code, but I am new to this so I may be wrong.
Your program needs to know the full path in order to find the file. It isn't just searching your computer for the file "inputValues2.txt". It needs to know exactly how to get there. If you wanted to, you could move the file into your project folder, and then you would just be able to write "inputValues2.txt" to access it. I normally create a folder called "res" in my project folder, and then let's say I am trying to create an image:
Image i = new Image("res/img.png");
Your file should be in the class-path. That's in the same directory that your main class is in.
The suggested practice is to place it in a Resources directory inside your class-path, then you can access it via, "Resources/inputValues2.txt".
I am trying to install Java jre 1.8u31 from the command line. I am using system level install configuration by using the deployment.config file and deployment.properties.
I have tried the following:
deployment.system.config=file\:C\:/WINDOWS/Sun/Java/Deployment/deployment.properties
deployment.system.config.mandatory=true
I have also tried the following
deployment.system.config=file:///C:/Windows/Sun/Java/Deployment/deployment.properties
deployment.system.config.mandatory=true
I have swapped the entries around in hopes of getting a better error describing what I am doing wrong. I have also made the first line blank in the deployment.config file. I have googled and tried all examples I could find online. In all the cases, I am being presented a dialog box with an error that states the deployment.config file's line 1 is malformed.
Any suggestions would be greatly appreciated.
Russ
I have tried all of these formats:
The path you have given should be in below format
deployment.system.config=file:/C:/Windows/Sun/Java/Deployment/deployment.properties
I got the install to work correctly. What I did was put the deployment.config file in the C:\Windows\Sun\Java\Deployment directory. The property in the file was setup as so:
deployment.system.config=file\:C\:\\Sup\\Java\\UPGRADE\\Deployment\\deployment.properties
The exceptionlist file was in the same directory as the deployment.properties file.
i am facing problem while compiling a java program i am using command promt to run the program . i have kept the file name and class name both same . also i set the path , i have also set the classpath .
the only reason i can come up with is that the may be the file gets saved with a ".txt" extension inside of a ".java" extensions, as filename.java.txt.
it shows the error
javac : file not found <file name.java>
if anyone have any idea about this please tell me.
If you are using Notepad, or a similar program to save your files, surround the entire file name in quotes in the save bar.
For example, instead of writing
program.java
Select "All Files" instead of "Text files", and then in the save text box, write
"program.java"
How your save file should look:
If this is the case, I would recommend using a text editor that is specifically for coding such as Notepad++ or Sublime Text
If you are on Windows Operating System then give the file Name in double quotes like this
"MyJavaFile.java"
then press Save button , it will save your file with java extension
I would like to make a simple eclipse/java program which goes through a folder with many log files and renames each log file based on strings of text found inside the log file.
The log files are all text files, but are named .log.
Here is a screenshot of the folder containing the log files:
Here is a screenshot of an individual log file. In this case, I would like this log file to be renamed "EFT Daily Activity Report," which shows up in each line.
The problem is I don't know how to go through folders in eclipse/java to access each of the files.
EDIT: Why doesn't this work? Am I missing something with the directory? Sorry, I'm new to local directories in java :)
You can have a look at the following tutorial for File:
http://tutorials.jenkov.com/java-io/file.html
If I understand your question correctly, the last example should be what you are looking for.