tag:blogger.com,1999:blog-55110372395972297002024-03-12T21:30:59.024-07:00Hot Java BlogGamerPlusPlushttp://www.blogger.com/profile/01409409616361823679noreply@blogger.comBlogger1125tag:blogger.com,1999:blog-5511037239597229700.post-40341198019733246992010-12-31T17:45:00.000-08:002011-01-01T00:49:30.484-08:00Getting StartedAlright, I've got the blog and the goal of teaching myself Java programming. What's next?<br />
<br />
The first thing I did was found the Java download page:<br />
<a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">http://www.oracle.com/technetwork/java/javase/downloads/index.html</a><br />
<br />
I downloaded and installed the JDK (Java development kit) + NetBeans bundle. It took forever to download and install and even longer to load NetBeans once it was installed. So I uninstalled NetBeans and Java and went back and downloaded the JDK by itself. That's all you really need to get started. Well that and a text editor, but there are more text editors than I care to list.<br />
<br />
So, I'm now armed with a new programming language, but I don't know how to use it. I need some help. I searched and found the Java documentation at:<br />
<a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html#docs">http://www.oracle.com/technetwork/java/javase/downloads/index.html#docs</a><br />
<br />
I downloaded and unzipped the files to my Java install folder. I clicked the index file and my web browser opened and a couple clicks later I was starting the "Hello World" tutorial: <a href="http://download.oracle.com/javase/tutorial/getStarted/cupojava/win32.html">http://download.oracle.com/javase/tutorial/getStarted/cupojava/win32.html</a><br />
<br />
So here's the tutorial.<br />
<br />
Open Windows Notepad (Programs > Accessories > Notepad). Type the following text:<br />
<pre>/**
* The HelloWorldApp class implements an application that
* simply prints "Hello World!" to standard output.
*/
class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!"); // Display the string.
}
}</pre><br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_scFclS4_te0/TR55dTGINZI/AAAAAAAAAQI/IfQlG6eZ9Bg/s1600/notepad.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="114" src="http://3.bp.blogspot.com/_scFclS4_te0/TR55dTGINZI/AAAAAAAAAQI/IfQlG6eZ9Bg/s320/notepad.JPG" width="320" /></a></div><br />
Save this file as "HelloWorldApp.java". Make sure you type correctly. Java is case sensitive. That means "HelloWorldApp.java" is not the same as "helloWorldApp.java".<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_scFclS4_te0/TR56bdgagmI/AAAAAAAAAQM/o3cGYSf28fw/s1600/saveAs.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="254" src="http://3.bp.blogspot.com/_scFclS4_te0/TR56bdgagmI/AAAAAAAAAQM/o3cGYSf28fw/s320/saveAs.JPG" width="320" /></a></div><br />
<br />
Open a command prompt (Programs > Accessories > Command Prompt) and navigate to where you saved "HelloWorldApp.java". To do this, type CD followed by the directory path. Here's a picture to show what I mean:<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_scFclS4_te0/TR59Ux8sNoI/AAAAAAAAAQQ/PmjOmsCqpHg/s1600/commandPrompt.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="http://1.bp.blogspot.com/_scFclS4_te0/TR59Ux8sNoI/AAAAAAAAAQQ/PmjOmsCqpHg/s320/commandPrompt.JPG" width="320" /></a></div><br />
You should see your command prompt change<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://3.bp.blogspot.com/_scFclS4_te0/TR6AkKha5oI/AAAAAAAAAQU/pSDDqHED_e0/s1600/commandPrompt2.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="158" src="http://3.bp.blogspot.com/_scFclS4_te0/TR6AkKha5oI/AAAAAAAAAQU/pSDDqHED_e0/s320/commandPrompt2.JPG" width="320" /></a></div><br />
Type the following command and press Enter:<br />
<pre>javac HelloWorldApp.java</pre><pre></pre><pre style="font-family: inherit;">This gives us a new class file</pre><div class="separator" style="clear: both; text-align: center;"><a href="http://1.bp.blogspot.com/_scFclS4_te0/TR6FTX2G-pI/AAAAAAAAAQY/soQKdiiXSz4/s1600/commandPrompt3.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="178" src="http://1.bp.blogspot.com/_scFclS4_te0/TR6FTX2G-pI/AAAAAAAAAQY/soQKdiiXSz4/s320/commandPrompt3.JPG" width="320" /></a></div><pre></pre><pre style="font-family: inherit;">We run our new class file with the following command:</pre><pre>java HelloWorldApp</pre><div class="separator" style="clear: both; text-align: center;"><a href="http://4.bp.blogspot.com/_scFclS4_te0/TR6G_j7ahSI/AAAAAAAAAQc/7i2BkiTV5Ig/s1600/commandPrompt4.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="44" src="http://4.bp.blogspot.com/_scFclS4_te0/TR6G_j7ahSI/AAAAAAAAAQc/7i2BkiTV5Ig/s320/commandPrompt4.JPG" width="320" /></a></div><pre></pre><pre></pre><pre><span style="font-family: inherit;">That's our first Java application!</span></pre>GamerPlusPlushttp://www.blogger.com/profile/01409409616361823679noreply@blogger.com0