Skip to content

☕ Small exercises to get you used to reading and writing Java code! Inspired by rustlings.

License

Notifications You must be signed in to change notification settings

oppahansi/javalings

Repository files navigation

GitHub Workflow Status GitHub GitHub issues GitHub pull requests GitHub last commit all-contributors

GitHub last commit

javalings ☕ 💻 (in development)

Greetings and welcome to javalings.

This project contains small exercises to get you used to reading and writing Java code.
This includes reading and responding to compiler messages!

In case you have not noticed it yet:
This project was inspired by rustlings.

javalings screenshots:


Installing javalings (auto)

Windwos

Open PowerShell (Run as Administrator). Navigate to the location where javalings should be installed. Then set ExecutionPolicy to RemoteSigned:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Then, you can run:

Start-BitsTransfer -Source https://raw.githubusercontent.com/oppahansi/javalings/main/install_javalings.ps1 -Destination $env:TMP/install_javalings.ps1; Unblock-File $env:TMP/install_javalings.ps1; Invoke-Expression $env:TMP/install_javalings.ps1

This will install the required dependencies and clone the repository in the current folder.
At the end it will clone the repository and navigate inside the javalings folder.

If you get a permission denied message, you might have to exclude the directory where you cloned javalings in your antivirus.

MacOs / Linux(Ubuntu) (NOT WORKING YET)

Navigate to the location where javalings should be installed. Then run:

curl -L https://raw.githubusercontent.com/oppahansi/javalings/main/install_javalings.sh | bash

Or if you want to pass in the path instead:

curl -L https://raw.githubusercontent.com/rust-lang/rustlings/main/install_javalings.sh | bash -s mypath/

This will install the required dependencies and clone the repository in the current folder.
Once everything is done, navigate inside the javalings folder.


Installing javalings (manually)

Windows

Java

Either use the installer from the oracle:
Oracle Installer

Or use a package manager:

chocolatey:

choco install openjdk --version=21.0.0

Git

Follow the official Git installation guides

Source Code

Either clone the repository:
Windows / MacOS / Linux(Ubuntu), in your preferred shell/console:

SSH

git clone [email protected]:oppahansi/javalings.git

HTTPS

git clone https://github.com/oppahansi/javalings.git

OR download the source code and extract it.

Note:
If you choose to download the source code the reset command will not work.
reset command needs repository cloning.

CMD/PowerShell color codes fix for Windows 10

I am using ANSI characters to display colors and special characters. To correctly display those in CMD or PowerShell you will have to enable
VirtualTerminalLevel.

Run this in powershell, not sure if admin is needed. Rerun as admin if it fails.

Set-ItemProperty HKCU:\Console VirtualTerminalLevel -Type DWORD 1
MacOs

Java

Either use the official Oracle DMG installer

or the brew package manager:

brew install openjdk@17

Git

Follow the official Git installation guides

Source Code

Either clone the repository:
Windows / MacOS / Linux(Ubuntu), in your preferred shell/console:

SSH

git clone [email protected]:oppahansi/javalings.git

HTTPS

git clone https://github.com/oppahansi/javalings.git

OR download the source code and extract it.

Note:
If you choose to download the source code the reset command will not work.
reset command needs repository cloning.

Linux(Ubuntu)

Java

sudo apt update
sudo apt install openjdk-17-jdk

Git

Follow the official Git installation guides

Source Code

Either clone the repository:
Windows / MacOS / Linux(Ubuntu), in your preferred shell/console:

SSH

git clone [email protected]:oppahansi/javalings.git

HTTPS

git clone https://github.com/oppahansi/javalings.git

OR download the source code and extract it.

Note:
If you choose to download the source code the reset command will not work.
reset command needs repository cloning.


Usage

Javalings Command

Windows

All commands begin with .\javalings.bat

Linux/MacOS

It might be needed to execute chmod +x javalings.sh and chmod +x gradlew before you can run javalings.
All commands begin with ./javalings.sh

Javalings Command Start Options

javalings is a placeholder, replace it depending on your OS:

  • .\javalings.bat on Windows
  • ./javalings.sh on Linux/MacOs

Tip:
Create an alias in your shell for the above script files.


Options
javalings help

    * Print all available options.  
javalings watch

    * Run exercises in the recommended order.  
javalings list

    * List all unsolved exercises.  
javalings run <option>

* Options:
    * exercise
        * Run the specified exercise.
    * next
        * Run the next unsolved exercise.
    * Example:
        * javalings run Intro1  
javalings reset <option>

* Options:
    * exercise
        * Reset the specified exercise.
    * all
        * Reset all exercises to its unsolved state.
        * CAUTION, this cannot be undone.
    * Example:
        * javalings reset Intro1  
        
DOES NOT WORK IF YOU DOWNLOAD THE SOURCE CODE.
RESET COMMAND NEEDS REPOSITORY CLONING.

Javalings Watch Mode Options

Commands available to you during the watch mode.

Options
help

    * Print all available watch mode options.  
hint

    * Prints a hint for the current exercise.  
google

    * Prints examples of what to google to find a solution.  
next

    * Run the next unsolved exercise. 
      Works only when the current exercise has been solved.  
reset

    * Resets the current exercise.  
    
DOES NOT WORK IF YOU DOWNLOAD THE SOURCE CODE.
RESET COMMAND NEEDS REPOSITORY CLONING.
clear

    * Clears the screen.  
quit or exit

    * Stops the exercise and quits javalings.    

Contributing

Help in any form is welcome! If you are interested in contributing to the project please
see CONTRIBUTING.md.


Contributors

Alexander Schellenberg
Alexander Schellenberg

💻

TODO (contributions welcome)

javalings commands

  • help
  • watch (without automatically jump to next exercise)
  • list
    • better display of unsolved items
  • run
  • reset

watch mode commands

  • help
  • hint
  • google
  • next
  • reset
  • clear
  • quit or exit

installer

  • Windows
  • MacOs / Linux

exercises (will need more time and effort)

  • intros (first version, still unsure)
  • exams
  • variables (first version, still unsure)
  • primitive datatypes (first version, still unsure)
  • strings basics
  • comments
  • operators
  • booleans
  • conditionals
  • switch
  • loops
  • arrays
  • foreach
  • lists
  • basic sorting of elements
  • basic searching of elements
  • basic summing of elements
  • classes
  • packages
  • complex datatypes
  • strings advanced
  • methods
  • getter setter
  • imports
  • enums
  • interfaces
  • inheritance
  • polymorphism
  • Method overloading / overriding
  • instanceof
  • stream api
  • ... more coming soon

Others

  • add allcontributors bot
  • rethink exercise order and structure
  • watch mode optimisation? Better implementation?
  • gitpod / codespaces ?
  • ... more to be added

About

☕ Small exercises to get you used to reading and writing Java code! Inspired by rustlings.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages