You have the code. What now?
I know it may be overwhelming. You did a couple of steps and you may not be sure why. I was like this once too.
I still remember when I was asked to set up my first software project at my first job. I got access to SVN (a Version Control System like Git that you already got to know a little bit) and received a detailed instruction on how to import the project. When it all was set up I looked at it and asked myself: what now? And I already knew how to program in Java. A little.
So I looked at Eclipse and I knew I had an application, but I had no idea what it was all about. How it works? What does it do? What should I look at first? I bet you have similar questions right now.
I had a great colleague, who sat with me and told me: “Aga this is a project that processes the data read from one system and translates it into another. See, here you have…” He explained the main points to me so I’ve got a quick overview and I didn’t feel as lost as in the beginning. It started my long way into Java World.
What you’ll do in Java
I’d like you to write a code for a calculator that performs arithmetical operations:
Calculator: Project Overview
Let’s take a look at what you’ve got in Eclipse.
On the left side of Eclipse, you have the Project Explorer. you can find there the Project named Calculator.
Under the project, you have two Source Folders: src/main/java and src/test/java. Those are folders that contain source code – files written in Java code.
- src/main/java – contains the Calculator.java file – where you will write the calculations
- src/test/java – contains CalculatorTest.java file that you will use to test the code written in Calculator.java
Then you can see JRE System Library – it indicates what Java you use to create your project. In real life, you may need to work on different projects using different Java versions. Here it’s JavaSE-1.8
In Project and External Dependencies you can see different *.jar files. In between, there’s junit-4.12 and hamcrestcore. Those are libraries – code written by someone else and put into *.jar file so you can use it in your program if you want/need it.
Under src folder, you’ll find the same *.java files you have in source folders, but under the exact folder (i.e. Calculator\src\main\java\blog\jumpstart\learningPath – see for yourself)
The rest are the files and directories in a Gradle project that make up the Gradle Wrapper – the wrapper allows to run Gradle tasks without installing the Gradle itself. Those are:
gradlew(Unix Shell script)
gradlew.bat(Windows batch file)
Now, that you know how the Eclipse project looks like let’s go a step further and finally write some code.