0

Please dont ban me for this question, i am a noob and i have googled this for hours now.

To make a console based Snake Game, i plan to use the jline Libary. However, when i try to call "Terminal" 's function getHeight()(i imported org.jline.Terminal already), there is an error:

Cannot make a static reference to the non-static method getHeight() from the type Terminal

this happens even though the Terminal import does have a function called getHeight().

i have an assumption: i think i need to generate an instance of something to use it. but for what do i need to generate an instance. or is the assumption wrong?

Do you have an Idea how to solve this?

Kind regards,

your Alwin :)

1 Answers1

0

org.jline terminal.Terminal#getHeight() is not a static method and therefore needs to be called on an instance of org.jline terminal.Terminal. You should probably use org.jline terminal.TerminalBuilder to obtain one.

The import merely allows you to use Terminal without the package name.

Manfred
  • 2,269
  • 1
  • 5
  • 14