Skip to content
This repository was archived by the owner on Jun 23, 2025. It is now read-only.

Commit cf79222

Browse files
committed
Added chatroom-java
1 parent 822b412 commit cf79222

File tree

12 files changed

+825
-2
lines changed

12 files changed

+825
-2
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ __pycache__
99
.idea/
1010
./dice
1111
*.rdb
12-
dice
13-
main
12+
/dice/
13+
/main/
1414
tmp/
1515
vendor/
1616

examples/chatroom-java/.gitignore

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
target/
2+
!.mvn/wrapper/maven-wrapper.jar
3+
!**/src/main/**/target/
4+
!**/src/test/**/target/
5+
6+
### IntelliJ IDEA ###
7+
# .idea/*
8+
*.iws
9+
*.iml
10+
*.ipr
11+
12+
### Eclipse ###
13+
.apt_generated
14+
.classpath
15+
.factorypath
16+
.project
17+
.settings
18+
.springBeans
19+
.sts4-cache
20+
21+
### NetBeans ###
22+
/nbproject/private/
23+
/nbbuild/
24+
/dist/
25+
/nbdist/
26+
/.nb-gradle/
27+
build/
28+
!**/src/main/**/build/
29+
!**/src/test/**/build/
30+
31+
### VS Code ###
32+
.vscode/
33+
34+
### Mac OS ###
35+
.DS_Store
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
wrapperVersion=3.3.2
18+
distributionType=only-script
19+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.7/apache-maven-3.8.7-bin.zip

examples/chatroom-java/README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# DiceDB Java Chatroom
2+
3+
A terminal-based chatroom application built in Java using [DiceDB](https://github.com/DiceDB/dice) and the [DiceDB-Java SDK](https://github.com/bipoool/dicedb-java). Each instance of the application connects to a shared DiceDB backend and communicates in real-time through a simple terminal interface.
4+
5+
---
6+
7+
## ⚙️ Requirements
8+
9+
- Java 21
10+
- Maven (use included `mvnw` wrapper)
11+
- DiceDB running locally on port `7379`
12+
13+
> Make sure DiceDB is up and running before you start the application.
14+
> Refer to [DiceDB README](https://github.com/DiceDB/dice/blob/master/README.md) for setup instructions.
15+
16+
---
17+
18+
## 🚀 Running the Application
19+
20+
### Using JAR
21+
22+
To build and run the JAR:
23+
24+
```bash
25+
# Step 1: Build the jar
26+
./mvnw clean install
27+
28+
# Step 2: Run the jar with a username
29+
java -jar target/chatroom.jar <username1>
30+
java -jar target/chatroom.jar <username2>
31+
```
32+
33+
### Using IntelliJ (Not in windows)
34+
35+
```text
36+
Just run the `main` method in the `Main` class with your desired username passed as an argument.
37+
```
38+
39+
## 💬 Interface Instructions
40+
41+
```text
42+
1. A popup terminal window will appear.
43+
44+
2. Type your message in the input box.
45+
46+
3. Use the Left Arrow Key to shift focus to the Send button.
47+
48+
4. Press Enter to send the message.
49+
50+
5. Write 'exit' to leave the chatroom.
51+
```
52+
53+
## 📸 Screenshots
54+
![Chatroom Screenshot](assets/chatroom.png)
55+
56+
## Want to contribute?
57+
```
58+
If you have suggestions or improvements, feel free to open an issue or submit a pull request. Your feedback is always welcome!
59+
```
66.7 KB
Loading
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>me.vipulgupta.dice.example</groupId>
5+
<artifactId>chatroom-java</artifactId>
6+
<version>1.0-SNAPSHOT</version>
7+
<build>
8+
<plugins>
9+
<plugin>
10+
<artifactId>maven-jar-plugin</artifactId>
11+
<version>3.3.0</version>
12+
<configuration>
13+
<archive>
14+
<manifest>
15+
<addClasspath>true</addClasspath>
16+
<mainClass>me.vipulgupta.dice.example.Main</mainClass>
17+
</manifest>
18+
</archive>
19+
</configuration>
20+
</plugin>
21+
<plugin>
22+
<artifactId>maven-shade-plugin</artifactId>
23+
<version>3.4.1</version>
24+
<executions>
25+
<execution>
26+
<phase>package</phase>
27+
<goals>
28+
<goal>shade</goal>
29+
</goals>
30+
<configuration>
31+
<finalName>chatroom</finalName>
32+
</configuration>
33+
</execution>
34+
</executions>
35+
</plugin>
36+
</plugins>
37+
</build>
38+
<properties>
39+
<maven.compiler.target>21</maven.compiler.target>
40+
<maven.compiler.source>21</maven.compiler.source>
41+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
42+
</properties>
43+
</project>

0 commit comments

Comments
 (0)