I was trying to clear the console on java using the eclipse IDE and for some reason, the code isn't working how it is supposed to be working. I think it is something to do with me using eclipse and I am wondering if there is an alternative way to do the following code on eclipse.
System.out.print("\033[H\033[2J");
System.out.flush();
the result I am getting from this code is...
[H[2J
if anyone knows away to get around this I will be happy to know.
Those are ANSI escape codes and they need support from the terminal. The standard terminal doesn't support them, but there are apparently plugins if you need that support (in Eclipse).
The flush() isn't related (or needed) in any way.
Related
When I do
System.out.println('说');
It just prints "?"
In the bottom right corner it says UTF-8 (so that is good).
I have no idea what I am doing wrong, any help much appreciated.
PS: When I make a python file and print it, it prints it properly. But not in java :(
I tried doing System.setProperty("file.encoding", "UTF-8"); but same result sadly. I tried running code in repl.it, and it works. But not in visual studios.
Note that windows Locale is set to support UTF-8. And I am using Consolas Font, which should support UTF-8.
I also tried uninstalling VS and installing it again - it didn't fix anything.
I am also using terminal for all output.
What is your machine language? Change the system language to Chinese, and modify the system locale to Chinese(you may need to restart the computer), then restart vscode and print out Chinese characters.
Another simple and effective way is to use the Code Runner extension. Install the extension and execute the script with Run Code, the OUTPUT panel will display the result.
I wrote something like a make-tool for latex documentation (in fact a maven plugin https://github.com/Reissner/maven-latex-plugin).
As this invokes just a bunch of command line tools
and i frequently have problems when new versions of those tools come up, i decided to provide a way to check the versions (in fact a goal).
E.g. i let my tool invoke pdflatex -v to get version of pdflatex.
This works fine for all tools but makeindex,
because makeindex offers no regular way, to get the version and nothing but that.
To find out by hand i just type makeindex and then ctrl-d on my bash shell.
The result is then
This is makeindex, version 2.15 [TeX Live 2020] (kpathsea + Thai support).
Scanning input file stdin...done (0 entries accepted, 0 rejected).
Nothing written in stdout.
Transcript written in stderr.
The keystroke ctrl-d seems to be tied to unicode 0004.
So from the bash shell, this works just fine.
Is there a way to do that with a java execution?
I tried to invoke (java string)
"makeindex \u0004" and related.
No success,... makeindex just quits with an error.
To be honest, I dont know why because from the terminal all is fine.
The last problem to solve: the procedure shall be platform independent.
Now tried some hack providing a dummy file.
But of course this is the contrary of elegant.
Assuming you use texlive, you could use
tlmgr info --only-installed --data="localrev" makeindex
which returns something like
52851
This is the revision information from the makeindex package you have installed. This is not the version number, but should be enough to detect if the installed version changes.
I have been searching for this but I could use a bit of help. I am not even sure if a plugin is the way to go with this.
Anyway, here is a description of what I want to do:
I have developed a Java project which is a source-to-source compiler. It translates Java files with jQuery blocks into Java-only files. It accepts a file from the cli arguments, transpiles it and outputs the result to a new file. I used ANTLR for this.
Now that the program is working, I would like to make some sort of plugin which makes use of it. Just like we can create a new Java project, code and run the program in eclipse, I would like to be able to create a new JavaWithJQuery project, be able to code, and when I run it with eclipse, it would use the project I made to transpile it and run it directly, instead of outputting a file with Java-only.
Is this possible? I would appreciate some tips, and advice on how to get started.
Thanks in advance! :)
I am looking for a way to print italics out of the Eclipse console. So that some variation of:
System.out.println((Some code)"Hello World");
Outputs:
Hello World
Is this even possible?
Thanks for your help!!
There are a few options available to you with this, but first off, I'll make it clear that this is not a default Java ability. It depends entirely on the Operating System and the output console you are using (Eclipse, Terminal, Command, etc).
JCurses
You can use the JCurses Library to give you additional functions over the default console window. You can find a tutorial here that might help you.
ANSI Escape Sequences
I found a link here that uses ANSI Escape Sequences to modify the text, and ran the code myself to double-check it worked fine. It certainly changed the font, and there are some escape sequences listed here that might help you.
I believe italics should be System.out.println("\030[3mHello World!\030[0m");
I am working on a Delphi project for the first time, I used to develop on Java.
Is there a way to print in delphi's console like in java.
System.out.println("Message");
which I used to test code and find bugs (primitively).
You must use Writeln (only for console applications).
{$APPTYPE CONSOLE}
begin
Writeln('Hello');
Readln;
end.
If you want to put a string in the IDE's event log, you can use the OutputDebugString function.
I usually use the following code for "debugging" my programs.
showmessage('Hello World');
That's how i do it.. :)
If you want something similar to Java console, you can use CodeSite, which uses an independent viewer
Another similar tool is TraceTool
More logging libraries on this question - Which logging library is better?
For debugging messages there is also the GExperts console to which you can write using the SendXXX procedures in GX_DbugIntf. This unit is part of the GExperts source code which is available on SourceForge.