Raspberry PI + React JS + Java
1. Setting up my development environment
Here I am again with something that I wanted to do from a long time but never really got the motivation to do it.
Recently I got my Raspberry PI 4 and I want to document everything I am doing with it!
There are more resources on Python available everywhere but Java is not less than anyone!
Let’s begin…
I Googled about the OS installation and the funniest part is that when I read that “You have to write the image to the SD card”, I actually copied and pasted it to the SD card and double clicked it. hahaha.
It was great to know about the “image writer” that I was supposed to use to “write” the image onto the SD card.
Google about it. You’ll get a lot of good resources to do this.
When I switched on my TV and the Raspberry PI connected to it, it was amazing to watch my TV being utilized for something amazing!
Initial setup:
I typed a few commands in the Raspberry PI terminal:
1- sudo apt install default-jdk
2- sudo apt install maven
3- sudo apt install nodejs
4- sudo apt install npm
I then installed VS CODE which was there in the following path:
Applications Menu (the Raspberry PI logo;top left corner)→Preferences → Recommended Software → Programming →Visual Studio Code
UPDATE THE PACKAGES:
Run the following commands:
1- sudo apt update
This will show you if any package can be updated.
I had 11 packages to be updated.
2- sudo apt full-upgrade
This will upgrade everything that’s possible.
JAVA Setup:
I have then installed the required extensions:
You can refer this for Java: https://www.youtube.com/watch?v=uq4GjRF_860
This video really helped me because I had never used VS Code for Java before.
REACT App:
In the VS CODE, the easiest way to create a react app is to run the following command:
npx create-react-app first-ui
But ooooppss!!
I had an older version of node. So to upgrade it, I found an excellent reference:
From the above link, here are the commands:
1- curl -sL https://deb.nodesource.com/setup_17.x | sudo -E bash -
2- sudo apt install nodejs
Then I tried running the npx command in VS Code again. It worked!
Therefore, the initial setup is done.
Now I can start experimenting…