User:Andy Maloney/Notebook/Lab Notebook of Andy Maloney/2011/04/18/Installing Java

From OpenWetWare
Jump to navigationJump to search

Installation

Installation of Eclipse was simple on Linux Mint 10. I just downloaded the Classic version of Eclipse and started it up. I added a link in my main menu as well.

Workspace

I added a workspace in the directory that has Eclipse in it. I think I'll keep it there from now on.

Tutorial

So there is a tutorial section that is supposed to get you to make a "hello world" application. I did it and was asked to write the following:

<source lang="java"> public class HelloWorld { public static void main(String[] args) { System.out.print("Hello world!"); } } </source>

It's funny but I didn't add the ln after print and the program worked. I suppose for absolute strictness, one should include the ln in code so that it reads:

<source lang="java"> public class HelloWorld { public static void main { System.out.println("Hello world!"); } } </source>

From what I understand, public is a declaration of the method used in the code. For the above case, my class is named HelloWorld and it is public to all the subclasses in the code. I suppose that if I was to have a subclass in the main section that I didn't want to be visible to other sections in the code, I wouldn't label it as public. I'd label it as something else, what ever that is.

I remember from C that void is not supposed to return a value and is usually accompanied with main.

Static apparently means that the method is tied to the class. I don't think I understand this though.

Running in a terminal

  • So far I have not been able to run the code in a terminal. I'm not sure why as it compiles and displays the hello world in the Eclipse environment.
    • Turns out I didn't have the JDK installed. It works just fine.