Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 is Java a free? if so were can i get?
Index -> Programming, Java -> Java Help
Goto page 1, 2, 3  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Vertico




PostPosted: Fri Mar 25, 2005 1:00 pm   Post subject: is Java a free? if so were can i get?

just wondering were it is. i have a java course coming up in school and would like 2 have a copy at home.
Sponsor
Sponsor
Sponsor
sponsor
wtd




PostPosted: Fri Mar 25, 2005 2:50 pm   Post subject: (No subject)

Yes it's free. http://java.sun.com
Vertico




PostPosted: Thu Apr 21, 2005 2:22 pm   Post subject: (No subject)

okay. i would like to know what i would downloaded for someone who wants to begin/start Java. i went to the website and found alot of different things.
rizzix




PostPosted: Thu Apr 21, 2005 2:28 pm   Post subject: (No subject)

http://java.sun.com/j2se/1.5.0/download.jsp

if ur interested in programming.. always download the JDK...
Vertico




PostPosted: Thu Apr 21, 2005 4:18 pm   Post subject: (No subject)

Okay I downloaded the file that u said, "JDK". After doing so, iv come across most likly the most pathetic, pointless problem.

Dont know how to open it so i can actually put code in. The Java application at my school looks alot like the turing programing screen, not sure if that is what this is suppost to look like but since there is no shortcut on my desktop or a icon in my start up window im having truble finding the program were you type in code.

i can find the java file folder and everything that was installed, but i dont know what im looking for.


P.S. im a 100% noob when it comes to Java.
wtd




PostPosted: Thu Apr 21, 2005 4:26 pm   Post subject: (No subject)

Java source code is just a plain text file that happens to end in ".java". Really. Other than that there's nothing special about it. So, type up a simple "hello world":

code:
import java.io.*;
import java.lang.*;

class HelloWorld
{
   public static void main(String[] args)
   {
      System.out.println("Hello world");
   }
}


Save it as "HelloWorld.java". Open a command prompt (Start -> Accessories). "cd" to the directory where you saved HelloWorld.java. Compile and run like so:

code:
prompt> javac HelloWorld.java

prompt> java HelloWorld
Vertico




PostPosted: Thu Apr 21, 2005 7:57 pm   Post subject: (No subject)

alright so this is what i got out of what you said :

i can make a file anywhere like notepad as long as i save it with a .java extension?

then i open up the Command Promt

thats all i got out of what u said. I dont know what you mean by compile and then what im suppost to do in the Command Prompt window.

remember im brand spanking new to Java and am just tryig to understand how to run programs and were 2 wright them.
wtd




PostPosted: Thu Apr 21, 2005 8:12 pm   Post subject: (No subject)

Yes, you can use any plain text editor. Keep in mind that word-processing programs typically add code you can't see for formatting, and thus are unacceptable. Make sure the extension is ".java". Some text edtors will automatically add ".txt", so you could end up with something like "HelloWorld.java.txt".

Compilation takes source code, which is the stuff that can be read by a human, and turns it into machine code. In this case we take Java source code and compile it into code that's executable by the Java Virtual Machine. We do this with the "javac" program.

We can then tell the Java Virtual Machine to run the code. This is done with the "java" program.
Sponsor
Sponsor
Sponsor
sponsor
Vertico




PostPosted: Fri Apr 22, 2005 2:19 pm   Post subject: (No subject)

can i get a step by step? i have a file called HelloWorld.java. what do i do after that? dont know how to work command prompt very good.
rizzix




PostPosted: Fri Apr 22, 2005 2:27 pm   Post subject: (No subject)

cd to_directory_with_file_HelloWorld.java
javac HelloWorld.java
java HelloWorld
Vertico




PostPosted: Fri Apr 22, 2005 2:45 pm   Post subject: (No subject)

rizzix wrote:
cd to_directory_with_file_HelloWorld.java


this is the part i still dont understand. how do i "cd" to directory?
wtd




PostPosted: Fri Apr 22, 2005 3:23 pm   Post subject: (No subject)

Vertico wrote:
rizzix wrote:
cd to_directory_with_file_HelloWorld.java


this is the part i still dont understand. how do i "cd" to directory?


"cd" is the command to "change directory". In a filesystem, files are organized into directories (or in the GUI age, "folders"). In the command prompt, you are only ever in one directory at a time. This is typically indicated in the prompt itself.

Of course, directories can themselves contain directories. And in Windows, there can be numerous filesystems, each with their own root. For the C drive, this root looks like:

code:
C:\


For D:

code:
D:\


I'm sure you see the pattern.

A directory at the top level of the C drive named "Foo" looks like:

code:
C:\Foo\


A "Bar" directory inside that one looks like:

code:
C:\Foo\Bar\


See the pattern?

Now, to cd into the "Baz" directory in the "Foo" directory from "C:\Foo\Bar\" I must first move up one level:

code:
C:\Foo\Bar\> cd ..


Then, I need to change into the "Baz" directory:

code:
C:\Foo\> cd Baz


Of course, this could have been shortened to:

code:
C:\Foo\Bar\> cd ..\Baz
Vertico




PostPosted: Fri Apr 22, 2005 4:31 pm   Post subject: (No subject)

okay i found out why i was having so much trouble with the changing directory. For some reason it wont change to my D drive where i use to have all the Java stuff. i moved it to my C drive and it now will change. Also i ran the helloworld file and im pretty sure it worked since it is only suppost to say hello world and thats what it said.



but then i tryed to run a demo that came with it (TicTacToe) and repeated the same actions i took for the helloworld file and changed my directory to it. then comacted with javac and then when i did the java TicTacToe all it said was TicTacToe and didnt actauly do anything else.

did i do something wrong? or is that all its suppost to do/say?
wtd




PostPosted: Fri Apr 22, 2005 5:45 pm   Post subject: (No subject)

To change to a different drive (C, D, etc.):

code:
C:\Yada\Yada\Yada\> D:
Vertico




PostPosted: Fri Apr 22, 2005 9:42 pm   Post subject: (No subject)

alright so lets see if i can understand this.


so i changed the directory to :

code:
C:\Program FIles\Java


and the file called Helloworld.java is saved in the file Java. then i type

code:
prompt> javac Helloworld.java

then
code:
prompt>java Helloworld


is this right??

after that it should show me what is suppost to be printed off right?
in the command prompt screen or in a new window?

well when i do all that all it does is writes Helloworld in the command prompt screen. Even if the msg inside the code is "happy happy".

What am i doing wrong and what should i be doing?
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 3  [ 31 Posts ]
Goto page 1, 2, 3  Next
Jump to:   


Style:  
Search: