A Java-based dictionary application implementing a client-server architecture that allows users to query, add, remove, and update word definitions through a graphical user interface.
- Multi-threaded Server: Handles multiple client connections simultaneously using a custom thread pool
- Graphical User Interface: Both client and server components feature user-friendly GUI
- Persistent Storage: Dictionary data is stored in a file and persists between sessions
- Real-time Updates: Immediate synchronization between server and connected clients
- Concurrent Access: Thread-safe dictionary operations for multiple users
DictionaryServer: Main server class with GUI control panelDictionary: Core dictionary data structure and operationsDictionaryFileHandler: Handles file I/O operationsClientHandler: Manages individual client connectionsProtocol: Implements the communication protocolCustomThreadPool: Manages worker threads for client connections
DictionaryClient: Main client class handling server communicationDictionaryGUI: User interface for dictionary operations
- Java Development Kit (JDK) 18 or higher
- Java Runtime Environment (JRE)
- Clone the repository
- Build the server:
cd DictionaryServer
javac -d out/production/DictionaryServer src/server/.java
jar cvfm DictionaryServer.jar src/META-INF/MANIFEST.MF -C out/production/DictionaryServer .- Build the client:
cd DictionaryClient
javac -d out/production/DictionaryClient src/client/*.java
jar cvfm DictionaryClient.jar src/META-INF/MANIFEST.MF -C out/production/DictionaryClient .- Start the server:
java -jar DictionaryServer.jar <port> <dictionary-file-path>- Start the client:
java -jar DictionaryClient.jar <server-address> <server-port>- Click "Start Server" to begin accepting client connections
- Monitor server status through the GUI
- Click "Stop Server" to terminate the server
- Query: Enter a word and click "Query" to find its meanings
- Add: Enter a word and its meanings (semicolon-separated) and click "Add"
- Remove: Enter a word and click "Remove" to delete it
- Update: Enter a word and new meanings to add to existing definitions
<action>:<word>:<meanings>
Actions:
query: Retrieve word meaningsadd: Add new word with meaningsremove: Delete a wordupdate: Add new meanings to existing word
Meanings are semicolon-separated strings.
- Success:
Success: <message> - Error:
Error: <message>
- Custom thread pool implementation
- Fixed pool size of 16 threads
- Thread-safe dictionary operations using synchronization
Dictionary data is stored in a text file with the format:
word:meaning1;meaning2;meaning3
- Connection failures
- Invalid requests
- Duplicate entries
- Missing words/meanings
- File I/O errors
This project is licensed under the MIT License - see the LICENSE file for details.