I've been trying to build a console clear command into my final assignment for school.
Beforehand I was trying to use a TerminalClear command; but this does not work as IntelliJ uses a Console instead of Terminal when running my application.
When researching my issue, I came across this Quora Post, and I saw Philip Gust's answer to it.
I downloaded JLine-console-3.23.0.jar and I have been trying to get this to work based on the limited documentation on its functionalities (that I could find).
import org.jline.*;
import java.io.IOException;
public class TerminalClear {
public static void main(String[] args) throws IOException {
Terminal terminal = TerminalBuilder.builder().build();
// Clear the terminal screen using JLine
terminal.puts(InfoCmp.Capability.clear_screen);
terminal.flush();
// Display a message to indicate that the console has been cleared
System.out.println("Terminal cleared!");
}
}
However its stricken with "Cannot resolve method / symbol 'x' " errors. Does anyone know how to fix this?