This may apply across languages in intellij, though my example is about Java. I have a breakpoint at the line after this one:
currentOut = new PrintStream(new FileOutputStream("tmp.output"));
The variables tab shows:
I have navigated down charOut, out, and testOut - nowhere is a path to file tmp.output shown. In the debugger, how can I see where this file got created?
It will be in the current directory of the Application.
You can get it in the debugger by executing this inside evaluate expression box:
new java.io.File(".").getAbsolutePath()
Related
When I run my program, the following code returns a null
ConsoleApp.class.getPackage().getImplementationVersion()
However, when I copy the JAR file to another folder outside my project's folder and execute it on the console, it returns the version number of my program correctly. I'm assuming my program has no access to the MANIFEST file during runtime. Still, I haven't found a satisfactory answer to this behaviour. Why is this happening? What's happening behind the scenes?
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.
I need to disable error highlighting in Java files in VS Code. VS Code tries to check a Groovy file while thinking it is a Java file.
As you can see in the picture all imports after the first and the types after the first field are highlighted red (due to missing semicolons). However I do not want the error check for this Groovy file.
NOTE: I only have the plugins Clang, RedHat.Java, Markdown PDF, Sort Lines, and Uncrustify installed. Even if I disable all the red highlighting is visible.
open your preferences file and add this
"java.validate.enable": false
I didn't try it for java, but it works for typescript.
I found this:
"problems.decorations.enabled": false,
You should disable the linter, which is by default enable in VS Code.
To do so you can go to File-> Prefrences -> setting
I wouldn't think this is necessary but you might try:
"files.associations": {
".groovy": "groovy"
}
in your user settings, assuming your file extension is .groovy. If it is something else, just set it to "groovy" as well. When I create a .groovy file with your content or gibberish I get no error linting at all. What is your file extension and what does Vscode call it in the bottom right of the editor? You can click on that file type to change its file associations. See modifying Vscode file extensions.
I am getting an error : Syntax error on tokens, delete these tokens, on valid Java code
My code, copied and pasted from eclipse, is here :
public class Test2 {
public static void main(String[] args) {
}
}
I am guessing that there is some hidden character in the code which I can't see.
I tried restarting Eclipse, and cleaning the project, but the error is still there!
Even if I copy and paste this code from SO into eclipse the error is still there!
what is going on here?
EDIT
Its not Eclipse! In Netbeans I get the same error :
Also, the original problem occurred when I tried to copy and paste code examples from this webpage http://blue-walrus.com/2011/05/advanced-swing-multithreading-tutorial/
I just did the following:
Cut and paste the code from your Question to a file and compiled it using javac (Java 8). No compilation errors.
Opened Eclipse (Kepler), created a Test2 class, copied the code from the Question to it, and saved it. No compilation errors.
My tentative conclusion is that there is nothing wrong with the java code. (No funky hidden characters, no nasty homoglyphs, no messed up character encodings.) The most likely cause of these weird errors is that your Eclipse session is messed up:
Try restarting Eclipse.
Try closing and opening the Project.
Try loading your code into a fresh workspace.
In extremis ... try a fresh install of Eclipse (same version as before ...)
Following on from my comments your project must have a valid JDK and JRE defined
If these are missing from your project, go to Window > Preferences> Java Installed JREs and click Add..
If you make any changes select Project > Clean... again
To remove these strange hidden empty space characters, I copy and pasted into Outlook Email, and then copy and pasted into Notepad++, and then copied into Eclipse. All fixed :)
Seems you need to copy and paste situations like this through a few different apps, to 'scrub' the text of any funny characters.
I think the java class path is not set in your computer if that is the case go to my computer->properties->Advanced System settings->Advanced tab click Environment variables find variable path & check if the java class path is there. If its not there i suggest you to copy the java class path & edit variable path & paste the url followed by ";" & then restart the eclipse.
better to check your project build path i.e, JRE system library version/is that set or not in the eclipse
way to go for properties section of eclipse :
right click on project - > choose properties ->build path->Libraries->Add Library Variable->JRE system library->click Add alternate JRE radio button->and select your machine jre->click finish->OK
after that go for java compiler in the same window (left side)->check the enable project settings->and choose your java version from drop down box->click Apply->OK
finally save your program and run it
if it again fails you need to check whether you are setting the classpath in proper or not, for this
please refer this link to set classpath :Link
ZWSP and other non-printing characters
Means a Zero-Width-Space character. You are using UTF8 and some characters have a width of 0 so you can not see them.
Change the Encoding to ANSI and back will solve your Problem.
The following problems are happening under an Eclipse plug-in project.
It is all ok that I use the FileReader to read a .txt file with an absolute path (such as. new FileReader("C:\\email.txt")).But if I try to use a relative path (such as new FileReader("email.txt")), it turns bad and throws an FNE.
And what's stranger is that, when I try to print the current path with the code new File(".").getAbsolutePath(), it turned out to be D:\Software\eclipse-rcp-juno-SR1-win32 (where I installed my Eclipse)...
I think the lazy-load design pattern of the RCP/Plug-in causes all the problem.Is it so?
This has nothing to do with the lazy loading policy or anything else OSGi-related. An application is started from some current working directory. In your case it happens that this directory is as you posted. You can set the current working directory to your liking under Eclipse's Run Configuration (the Arguments tab).