Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Running Your First Java Program Sticky

A topic by cloudyheavengames created Jun 03, 2018 Views: 292
Viewing posts 1 to 1
Host

Hopefully by now, you've gone through the steps of installing the Java Developer Kit on your computer.  If not, check the post here: https://itch.io/jam/summer-learn-java-jam-month-1/topic/236731/how-to-set-up-java-on-your-computer-link-to-instructions-included.

  The next question becomes, what will you use to write and run your programs?  The best answer depends on who you ask!

  A lot of my students use what's called an integrated development environment (IDE).  What's an IDE?  Here's a description from Techopedia:   "An Integrated Development Environment (IDE) is an application that facilitates application development. In general, an IDE is a graphical user interface (GUI)-based workbench designed to aid a developer in building software applications with an integrated environment combined with all the required tools at hand.

Most common features, such as debugging, version control and data structure browsing, help a developer quickly execute actions without switching to other applications. Thus, it helps maximize productivity by providing similar user interfaces (UI) for related components and reduces the time taken to learn the language. An IDE supports single or multiple languages. "

From <https://www.techopedia.com/definition/26860/integrated-development-environment-ide

A lot of AP Computer Science and college Java courses use an IDE called JGrasp, and I've also seen some students us BlueJ.  These are more light-weight programs that don't take up a lot of installation space or system resources.  

On the other hand, in professional environments, the projects I've worked on usually use Eclipse IDE or something based on it, like IBM Rational Application Developer (RAD) or SpringSource Tool Suite.  I took my first Java class using Eclipse, and at that time, it did take up more space and resources than some of the lightweight tools, and I think that's true of several other IDEs as well.  In addition, enterprise tools like RAD cost a lot of money.  If you want to try Eclipse at some point, the experience could be a plus on a resume for projects that use Eclipse-based IDE.  But for beginners, I think something like JGrasp of BlueJ will be just fine.  

Here's a comparison of some of the most popular IDEs, if you'd like to try one:  https://codecondo.com/10-best-java-ides-java-programmers/.  Again, people have lots of opinions on this topic, but you can try a few and see what works for you.  JGrasp seems to work well for the students I've tutored.  

But to be honest, for smaller projects I like to use a text editor to write my code, and then run it from the command prompt (cmd.exe) in Windows.  Notepad++ is my favorite text editor for coding, and if you're not using Windows, you should still be able to use the command line specific to your system.  You can also use just plain Notepad (if you're using Windows) or whatever built-in text editor comes with your system, but I really recommend giving Notepad++ a try.  You can find more information about it here: https://notepad-plus-plus.org/  

If you're using Mac or Windows, and you would like to run a program from the command line, here's instructions on how to do so: https://www.wikihow.com/Compile-%26-Run-Java-Program-Using-Command-Prompt 

Here's another, more general link: http://www.oracle.com/technetwork/java/compile-136656.html.  This link also includes a short example program that you can run, called ExampleProgram.java.

If you're running a UNIX-based system, the process should be similar.  

Why Do I Recommend a Text Editor and Command Prompt?  

For beginners, I highly recommend at least starting with just a text editor and command prompt.  There's a few reasons for this suggestion.  

  • This approach uses up a lot less space and system resources.  A text editor won't be using up your CPU when you open the Task Manager to see what's running on your system.
  • Using an IDE for simple, small programs is often overkill.  A lot of times when my students use IDEs, they have to create a whole Java project before they can even run a program.  Depending on the IDE, you probably don't have to actually do all that, but it would take more time for me to get the student to screenshare with me so that we could figure out how to just run a small bit of code outside of a project. 
  • IDEs have helpful features, such as autocorrection and code completion suggestions.  They also usually highlight potential errors, bugs and typos as you're typing.  These features are very useful, especially if you're in the workplace and looking for ways to be develop more efficiently.  However, I find that it becomes a crutch for new students.  They rely on the IDE to "fill in the blanks" for them, which is a problem especially when they take the AP exam or other tests that require them to write code by hand, on paper.  They don't have the IDE to remind them the name of a specific method, or to point out their mistakes.  I compare it to learning basic arithmetic; if you're taking a test on your multiplication tables, it doesn't help you learn if you use a calculator.  Once you've learned the basics, then you can use a calculator, and in fact it will help you focus on doing more complicated tasks. 

So, having said all of that, here's my recommended action steps for you.  

  1. Make sure that you've installed the Java Developer Kit, as instructed in this post: https://itch.io/jam/summer-learn-java-jam-month-1/topic/236731/how-to-set-up-java-on-your-computer-link-to-instructions-included.
  2. Decide whether you will use an IDE or just a text editor or command prompt.
  3. Once you've got either your IDE or text editor installed, try to compile and run the ExampleProgram.java program at this link: http://www.oracle.com/technetwork/java/compile-136656.html.  This will also help confirm that your computer has been properly set up to develop and run Java programs.
  4. If you have a problem or need help, post here.