# \#QP2 : Help in Java

**URL:** <https://forum.codecrafters.io/t/qp2-help-in-java/15777>\
**Category:** Challenges\
**Tags:** challenge:shell\
**Created:** [January 14, 2026, 8:41am UTC](https://forum.codecrafters.io/t/qp2-help-in-java/15777 "2026-01-14T08:41:30Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Molik2801](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/molik2801/32/21622_2.png) [@Molik2801](https://forum.codecrafters.io/u/Molik2801)\
**Post date:** [January 14, 2026, 8:41am UTC](https://forum.codecrafters.io/t/qp2-help-in-java/15777/1 "2026-01-14T08:41:31Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![senevoldsen](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/senevoldsen/32/6460_2.png) [@senevoldsen](https://forum.codecrafters.io/u/senevoldsen)\
**Post date:** [January 14, 2026, 12:01pm UTC](https://forum.codecrafters.io/t/qp2-help-in-java/15777/3 "2026-01-14T12:01:50Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![Molik2801](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/molik2801/32/21622_2.png) [@Molik2801](https://forum.codecrafters.io/u/Molik2801)\
**Post date:** [January 14, 2026, 12:16pm UTC](https://forum.codecrafters.io/t/qp2-help-in-java/15777/4 "2026-01-14T12:16:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [January 14, 2026, 12:38pm UTC](https://forum.codecrafters.io/t/qp2-help-in-java/15777/5 "2026-01-14T12:38:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Molik2801](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/molik2801/32/21622_2.png) [@Molik2801](https://forum.codecrafters.io/u/Molik2801)\
**Post date:** [January 14, 2026, 12:40pm UTC](https://forum.codecrafters.io/t/qp2-help-in-java/15777/6 "2026-01-14T12:40:15Z")

</div>

Ah okay.  
But then how can i test locally ?

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [January 14, 2026, 12:42pm UTC](https://forum.codecrafters.io/t/qp2-help-in-java/15777/7 "2026-01-14T12:42:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Molik2801](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/molik2801/32/21622_2.png) [@Molik2801](https://forum.codecrafters.io/u/Molik2801)\
**Post date:** [January 14, 2026, 12:42pm UTC](https://forum.codecrafters.io/t/qp2-help-in-java/15777/8 "2026-01-14T12:42:59Z")

</div>

Ah, cool then.  
Thanks.

---

<div class="post-metadata">

**Author:** ![Molik2801](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/molik2801/32/21622_2.png) [@Molik2801](https://forum.codecrafters.io/u/Molik2801)\
**Post date:** [January 14, 2026, 1:00pm UTC](https://forum.codecrafters.io/t/qp2-help-in-java/15777/9 "2026-01-14T13:00:54Z")

</div>

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

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/d/3/d3515b38a2d70545940fa64d52f9855e4f7a5541.png)

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/e/6/e67b51fc6366b35ba08a997c2a9d3c74832e1dac.png)

Here is my github repo : [GitHub - Molik2801/codecrafters-shell-java](https://github.com/Molik2801/codecrafters-shell-java)

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [January 27, 2026, 5:37am UTC](https://forum.codecrafters.io/t/qp2-help-in-java/15777/11 "2026-01-27T05:37:23Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Molik2801](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/molik2801/32/21622_2.png) [@Molik2801](https://forum.codecrafters.io/u/Molik2801)\
**Post date:** [January 27, 2026, 5:40am UTC](https://forum.codecrafters.io/t/qp2-help-in-java/15777/13 "2026-01-27T05:40:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/7/0/700657133935c15703e22c7c8870394f6e6dc27d.svg) [@system](https://forum.codecrafters.io/u/system)\
**Post date:** [February 1, 2026, 5:40am UTC](https://forum.codecrafters.io/t/qp2-help-in-java/15777/14 "2026-02-01T05:40:56Z")

</div>

Closed on February 1, 2026, 5:40am UTC

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