<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Tim Cinel &#187; Java</title>
	<atom:link href="http://www.timcinel.com/category/study/programming/java/feed" rel="self" type="application/rss+xml" />
	<link>http://www.timcinel.com</link>
	<description>Where I exercise freedom of speech</description>
	<lastBuildDate>Tue, 07 Sep 2010 22:00:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Using Java in Windows Command Prompt</title>
		<link>http://www.timcinel.com/2008/using-java-in-windows-command-prompt</link>
		<comments>http://www.timcinel.com/2008/using-java-in-windows-command-prompt#comments</comments>
		<pubDate>Tue, 22 Jul 2008 01:55:50 +0000</pubDate>
		<dc:creator>Tim Cinel</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Software Solutions]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[solutions]]></category>
		<category><![CDATA[troubleshooting]]></category>

		<guid isPermaLink="false">http://www.timcinel.com/?p=51</guid>
		<description><![CDATA[It seems that the Java Runtime Environment installer doesn&#8217;t automatically add the binary path of java and javac to the system environment variables, so the &#8216;java&#8217; and &#8216;javac&#8217; commands can&#8217;t be used without a path. For example, when you type &#8220;javac test.java&#8221; while in your test project directory, you might get the following message: &#8216;javac&#8217; [...]]]></description>
			<content:encoded><![CDATA[<p>It seems that the Java Runtime Environment installer doesn&#8217;t automatically add the binary path of java and javac to the system environment variables, so the &#8216;java&#8217; and &#8216;javac&#8217; commands can&#8217;t be used without a path. For example, when you type <strong>&#8220;javac test.java&#8221;</strong> while in your test project directory, you might get the following message:</p>
<p><span style="color: #800000;"><strong>&#8216;</strong><strong>javac&#8217; is not recognized as an internal or external command, operable program or batch file.</strong></span></p>
<p>The solution to this problem is pretty simple and should take less than two minutes to solve, so let&#8217;s solve it&#8230;<span id="more-51"></span></p>
<p>Start by locating a directory named &#8216;bin&#8217; the installation directory of Java Runtime Environment on your computer. On my computer, it&#8217;s &#8220;C:\Program Files\Java\jdk1.6.0_05\bin&#8221;. Once you find it, copy the directory&#8217;s path.</p>
<p>Now the solution &#8211; right-click &#8220;My Computer&#8221; and click properties.</p>
<p>In System Properties, go to the &#8220;Advanced Tab&#8221; and then click &#8220;Environment Variables&#8221;.</p>
<p>Locate the &#8220;path&#8221; item in the &#8220;System Variables&#8221; list and click &#8220;Edit&#8221;.</p>
<p>Append the path of your bin directory with a leading semicolon (;) and enclose it with quotes. For example, I would append:</p>
<p>;&#8221;C:\Program Files\Java\jdk1.6.0_05\bin&#8221;</p>
<p>Click &#8220;Ok&#8221;, &#8220;Ok&#8221;, and finally &#8220;Ok&#8221;.</p>
<p>Now go to the Command Prompt (Winkey + R &gt; &#8220;cmd&#8221; &gt; Enter) and type &#8220;javac -version&#8221;, you should get something like:</p>
<p><em><strong>C:\Documents and Settings\Tim&gt;javac -version<br />
javac 1.6.0_05</strong></em></p>
<p>Hooray.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.timcinel.com/2008/using-java-in-windows-command-prompt/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Programming 1, Tutorial 1</title>
		<link>http://www.timcinel.com/2008/programming-1-tutorial-1</link>
		<comments>http://www.timcinel.com/2008/programming-1-tutorial-1#comments</comments>
		<pubDate>Sat, 08 Mar 2008 14:52:02 +0000</pubDate>
		<dc:creator>Tim Cinel</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[answers]]></category>
		<category><![CDATA[notes]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://www.timcinel.com/2008/programming-1-tutorial-1</guid>
		<description><![CDATA[For our first tutorial, we had to go through and answer some questions about programming and Java, here are my answers: 1. Product Development Life Cycle Editing Writing source code Saving Recording or storing the file for future access. Compiling Translate source code (human readable) into platform specific executable machine code. So for each platform, [...]]]></description>
			<content:encoded><![CDATA[<p>For our first tutorial, we had to go through and answer some questions about programming and Java, here are my answers:</p>
<p><span id="more-7"></span></p>
<h2>1. Product Development Life Cycle</h2>
<h3>Editing</h3>
<p>Writing source code</p>
<h3>Saving</h3>
<p>Recording or storing the file for future access.</p>
<h3>Compiling</h3>
<p>Translate <em>source code</em> (human readable) into <em>platform specific</em> executable <em>machine code</em>. So for each platform, you need to compile a version for that platform. <strong><em>Not for Java.</em></strong></p>
<h3>Execute</h3>
<p>Run the <em>compiled</em> code.</p>
<h3>Debugging</h3>
<p>Check for coding errors like <em>syntax</em>, <em>logic</em> and <em>runtime</em> errors.</p>
<h2>2. When Java Compiles</h2>
<ol start="1" type="1">
<li>Create Source Code</li>
<li>Java compiler</li>
<li>Compiled into <em>platform-independent bytecode.</em></li>
<li>Compiled <em>bytecode</em> can be executed on any platform that has the Java      Runtime Environment.</li>
</ol>
<p><strong><em> </em></strong></p>
<h2>3. Running a Java Program</h2>
<p>Compile: <strong><em>javac &lt;filename&gt;.java</em></strong></p>
<p>Run: <strong><em>java &lt;filename&gt;</em></strong></p>
<p>To compile, the JDK is required. To run, the JRE or JDK is required.</p>
<h2>4. The Main Method</h2>
<p>The main statement is preceeded by the following:</p>
<p><strong><em>public static void</em></strong></p>
<p><em>‘public&#8217; </em> allows processes outside of the class access the main statement.</p>
<p><em>‘static&#8217; </em>allows us to call that method without having any instances of the parent object existing.</p>
<p><em>‘void&#8217; indicates there&#8217;s no return value</em></p>
<p><em> </em></p>
<h2>5. Identifiers</h2>
<p>Identifiers are the <em>handle </em>used to access an <em>object</em>, <em>primitive variable</em>, or <em>method</em>.</p>
<p>Identifiers can have:</p>
<ul class="unIndentedList">
<li> Letters</li>
<li> Numbers</li>
<li> Underscore and Dollar Sign</li>
</ul>
<p>They can not:</p>
<ul class="unIndentedList">
<li> Contain spaces</li>
<li> Be a reserved keyword</li>
</ul>
<p>a) Yes  b) No c) yes d) yes e) no f) yes g) yes h) yes i) no j) no k) no l) no m) yes n) yes</p>
<h3>Conventions for Identifiers</h3>
<p>Pick a consistent naming system.</p>
<p>Primative variables should begin with  a lowercase, and words can be separated like:</p>
<p>Int numberStudents;</p>
<p>Int number_students;</p>
<p>Constants should be upper case, like:</p>
<p>Final NUMBER_STUDENTS;</p>
<h2>6. Example Code</h2>
<p>public class HelloWorld</p>
<p>{</p>
<p>public static void main(String[] args)</p>
<p>{</p>
<p>System.out.print(&#8220;Welcome &#8220;);</p>
<p>System.out.println(&#8220;To &#8220;);</p>
<p>System.out.print(&#8220;RMIT&#8221;);</p>
<p>}</p>
<p>}</p>
<p>a)      Class declaration must be specified because a java app needs at least 1 class.</p>
<p>b)      ‘main&#8217; is required because it&#8217;s the <em>entry point </em>of our project. Its purpose is to create required objects and call other required methods.</p>
<p>c)      System.out.print(&#8220;Welcome)&#8230; calls the System.out object, referring to the output stream. It throws &#8220;Welcome&#8221; to the console.</p>
<p>d)      System.out.print prints at the current cursor position, System.out.print prints and then moves the cursor to the next line.</p>
<p>e)      In unix, it would produce:<br />
Welcome To<br />
In windows, it would produce:<br />
Welcome To<br />
RMIT<br />
Refer to Extra, Unix Buffer for the reason.</p>
<h2>7. Debugging Syntax</h2>
<p>// /* programs need</p>
<p>comments */</p>
<p>public class OneOne</p>
<p>{</p>
<p>public static void main(String[] args)</p>
<p>{</p>
<p>aString = new String(&#8220;Well!&#8221;);</p>
<p>int 2ndString = &#8220;Now!&#8221;;</p>
<p>System.out.println(&#8220;Isn&#8217;t this an interesting program);</p>
<p>System.out.println(&#8220;Answer yes or no!&#8221;)</p>
<p>}</p>
<p>}</p>
<ul class="unIndentedList">
<li> Errors: Comments are incorrectly formatted</li>
<li> Note: classes are public by default, but it&#8217;s a good idea to include public.</li>
<li> aString&#8217;s type hasn&#8217;t been declared (aString = new String(&#8220;Well!&#8221;);</li>
<li> Tried to string data into an int type var int 2ndString = &#8220;Now!&#8221;;</li>
<li> Invalid variable name 2ndString 2ndString</li>
<li> No closing quote System.out.println(&#8220;Isn&#8217;t this an interesting program);</li>
<li> No semicolon System.out.println(&#8220;Answer yes or no!&#8221;)</li>
<li></li>
</ul>
<h2>Extra:</h2>
<h3>Unix Buffer:</h3>
<p>In Unix, output won&#8217;t print until it receives a newline character &#8220;\n&#8221;</p>
<h3>Output Streams:</h3>
<p>.out</p>
<p>.err</p>
<h3>Input Streams:</h3>
<p>.in</p>
]]></content:encoded>
			<wfw:commentRss>http://www.timcinel.com/2008/programming-1-tutorial-1/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
