#QP2 : Help in Java

I want to know what the expected solution is for this tab autocompletion in Java.
I know two ways: one is to use the Java JLine library, and the other is to enable and disable raw mode.
I think doing it manually with rawMode will be complicated for further tasks.

But JLine is causing problem in adding dependency in maven for me.

so which method should i use?

The simplest and quick way is probably using JLine. I suppose readline library could be used with JNI.

The challenges mostly resolves around TAB completion and history buffers, so researching a bit, if seems the VT100 is an almost universal subset of terminal emulation that support both TAB and Arrows so calling a function that reads in raw mode and handles the basic VT100 sequences might be enough (but I admit I don’t know enough to be sure).

I tried JLine, but for it, I have to add a dependency in Maven, and I don’t know how to add those in CodeCrafters server

so that’s why, since the last 3 hrs I am writing it from scratch using raw mode and checking for every character that the BufferedReader is reading.

i dont know that for further tasks how difficult will it be if i continue doing it from scratch w/o using JLine library.

Hey @Molik2801, once you add JLine as a Maven dependency, our tester should pick it up automatically during the build.

Let me know if you run into any issues.

Ah okay.
But then how can i test locally ?

@Molik2801 You can run ./your_program.sh to start your shell locally and test it just like a normal shell.

Ah, cool then.
Thanks.

Hey can you also check why test are failing when it is clearly working in my local testing.

Here is my github repo : GitHub - Molik2801/codecrafters-shell-java

Hey @Molik2801, looks like you’ve got past this stage. Do you happen to remember what was wrong? Would love to see if we can improve the tester / instructions.

no i am still stuck in this stage but the major problem was fixed when i changed my code from using rawMode to Jline library, i still dont know why it was failing in rawMode.
now only minor issues are left which i will fix myself.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.