I was thinking of starting this blog off by assuming general knowledge of Java but then I figured I'd put in some extra effort and make my own "Super Awesome Learning Java the RIGHT way" type post where I explain how to code Java my way and why it's superior to everyone else's. Sarcasm definitely intended.
If you already have a general grasp of Java and want to learn some more I highly recommend Java Programming by Poornachandra Sarang
, a book I found very helpful when learning the more complex side of Java, like sockets and callable functions.
So here we're going to layout the planning of the 'course' you'll be taking.
Intro Guide*Subject to change
Lesson 1: Setting up the JDK and IDE
I am currently on a Windows PC so everything I say and do here will work on Windows. I will be providing links to the generic download pages for the software I talk about so there should be download links for Mac and Linux as well. Install instructions for those operating systems can also be found on the sites I link and I will not be explaining any special steps to take for them.
With that being said let's begin. Step 1, install the JDK.
To install the JDK go to the Java SE download
site and install the newest version of the Java JDK. Make sure to choose the correct version for your hardware and if possible chose the x64 version as it has a higher memory cap which is useful with big programs.
While you're running the install I'll explain why you need the JDK. Java has two main releases. The JRE(Java Runtime Enviroment) which can interpret java code and run programs just fine, but it does not include the tools of source files required to build java programs. The JDK(Java Development Kit) is a set of tools and source files which can be used to create, compile and run java programs. If you install a JDK you do not need a JRE as the JDK can do everything the JRE does.
Some of you may have heard about java being cross-platform and wonder what that means exactly. Any language can be cross platform right? Technically. Java does all the heavy lifting for you in terms of cross-platform compatibility. So instead of needing to compile your program for ever operating system you want to support, Java has its own virtual client, which is compiled for each operating system, in which it runs the program. So as long as the JRE is compiled for your operating system of choice you can run Java code made on any operating system.
So now that you have the JDK installed you're set. With that and a simple text editor you can code a fully functional program, compile it and send it off to everyone you know. Now most guides I've seen start you off with a simple text editor doing simple stuff and compiling it all yourself so you can feel like you're at one with the compiler. I wont be doing that. We're gonna jump right into the biggest time saver in Java.
The IDE. Integrated Development Environment. This program will do everything you don't want to. It will compile everything for you, export you program into an executable .jar, code-completion, import, export, API integration, Java-Doc creation. Point being it's good. Really good! So let's get into it. There are a tonne
of IDEs for Java and picking one to suit your needs is not always the easiest thing to do. The "official" IDE is NetBeans
but I've been using a different one for years so that's the one I'll be walking you through the install of today.
Eclipse, the godsend of IDE. Okay maybe not but this IDE is definitely top 3 in most people's books. So we're going to download
Eclipse and set it up right now. Go ahead and download the newest version and follow the install instructions. Once everything is downloaded open it up. When asked for your workspace location you can set it to whatever you want. This will be where the files you create are stored but don't worry you can find it later if you forget where it is. So once you've setup your workspace you'll see the Welcome screen, go ahead and close that by pressing the X in the top left of that page. The program will readjust itself to the new view and you'll be left with a lot of blank space.
In the left pane go ahead and right-click in the empty space. At the top of that list hover over "New" and select "Java Project". This window is the project creation wizard. All of the default setting are fine to leave as is. For the "Project name" you can put anything you want but I will be using "Intro Guide". Press finish and you'll have a folder now in that left pane with "src" and "JRE System Library" or something to that effect inside.
That's it for lesson 1! We've setup the JDK and the Eclipse IDE and make the project we're going to be using throughout this guide. Next lesson we're going to be going over some simple concepts and making our first program.
Lesson 2 >