Computer Science Canada

Very First Thing To learn?

Author:  Kyle [ Mon Jun 27, 2005 11:32 am ]
Post subject:  Very First Thing To learn?

Ok all of you might think im a big dumb @$$ for posting this but i downloaded NerBeans 4.1 last night. and i just finished grad 10 computer science (Turing and i think i did ok in that class) Now im going to be tacking Java in grade 11 and i have no idea how touse netbeans or how to program in Java. Im asking how do you out put text to the screen i was given a line cant remeber but i tryed it and it did not work. is Netbeans for beginers? and how do you output text to the screen?
Sory if my lack of Java programing disterbs you guys.
Crying or Very sad

Author:  Aziz [ Mon Jun 27, 2005 12:43 pm ]
Post subject: 

This is what you need. Start from the beginning. Java isn't like Turing. Turing you can simply say "put "Hello World!"", but Java is strictly object-orientated, everything is done in classes, and you need to set up your enviroment. Read this, and ask your teaching for a textbook:

http://java.sun.com/docs/books/tutorial/

Author:  Kyle [ Mon Jun 27, 2005 1:38 pm ]
Post subject: 

hmm thanks alot pal that rely helps. Very Happy

Author:  Aziz [ Mon Jun 27, 2005 2:44 pm ]
Post subject: 

Not a problem. Good look diving into Java Razz

Author:  Kyle [ Mon Jun 27, 2005 9:19 pm ]
Post subject: 

ok at that site you sent me it gives me an example of how to output "Hello World" on to the screen.
code:
/**
 * The HelloWorldApp class implements an application that
 * simply displays "Hello World!" to the standard output.
 */
class HelloWorldApp {
    public static void main(String[] args) {
        System.out.println("Hello World!"); //Display the string.
    }
}

When i try to run this example it says <No main classes found> or < class "filename" does not have a main method. this might be easy for you guys but this is my first day. So what does this mean....... Im using Netbeans 4.1. Rolling Eyes

Author:  Naveg [ Mon Jun 27, 2005 10:01 pm ]
Post subject: 

the square brackets go after the args

code:
public static void main (String args[])

Author:  wtd [ Mon Jun 27, 2005 10:28 pm ]
Post subject: 

Vladimir wrote:
the square brackets go after the args

code:
public static void main (String args[])


No. They don't.

Replace "class HelloWorldApp" with "public class HelloWorldApp".

Author:  Naveg [ Mon Jun 27, 2005 11:09 pm ]
Post subject: 

That too Embarassed

Author:  Kyle [ Tue Jun 28, 2005 8:18 pm ]
Post subject: 

hmm... nope. the code is
code:
public class HelloWorldApp {
    public static void main(String args []) {
        System.out.println("Hello World!"); //Display the string.
    }
}

still i get <No main classes found> or < class "filename" does not have a main method ... hmm i think i did what you gys said. . . Embarassed

Author:  rizzix [ Tue Jun 28, 2005 8:42 pm ]
Post subject: 

post ur file...

Author:  Kyle [ Tue Jun 28, 2005 10:13 pm ]
Post subject: 

Confused hmm ok thats all the code so heres the file Sad

Author:  rizzix [ Tue Jun 28, 2005 11:13 pm ]
Post subject: 

ehm... some project settings in netbeans??... try changing ur filename to HelloWorldApp.java or the class name to Main.

it is a standard convention in java to name the .java file after the class name (or visa versa).. please do follow the conventions.

Author:  Kyle [ Wed Jun 29, 2005 8:50 pm ]
Post subject: 

Crying or Very sad Crying or Very sad Crying or Very sad hmm i tryed naming the class to Main but still nothing. I dunno what im going to do... im taking Java in school next year Sad Sad Sad Embarassed ... I dought that the schools use netbeans... Is there an easer program for beginers that no nothing at all about Java. I heard that [ Ready to Program is very easy] but i dunno if its free, Can you send me a link to an easy program which i can learn jave easly. Please Embarassed Sad Sad Sad Sad

Author:  wtd [ Wed Jun 29, 2005 9:16 pm ]
Post subject: 

Ifyou want something easier to use for this level of programming, simply use a text editor and the command-line tools Sun provides.

Author:  Kyle [ Wed Jun 29, 2005 9:26 pm ]
Post subject: 

ok thanks i will read up on that. Very Happy THANKS Very Happy

Author:  Kyle [ Wed Jun 29, 2005 10:11 pm ]
Post subject: 

hmm buy comand lines do you mean the command promt..
so it will look like
C:> javac hello world.java
if so when i open comand prompt it says c:/Documents and Settings/Owner>
and the file is on the desktop to so it would be c:/Documents and Settings/Owner>Desktop/javac hello world.java ?? or is there another whay to open this?.

Author:  wtd [ Wed Jun 29, 2005 11:33 pm ]
Post subject: 

You'll need to setup the Path environment variable. so you can access java and javac from anywhere. Right now my brain is so dead, that I'll leave it up to someone like rizzix, though.

Author:  [Gandalf] [ Thu Jun 30, 2005 1:34 am ]
Post subject: 

Oh, oh, I know how to do this now. If you are using Windows XP for sure, if something else then maybe. This is what you need to do to change the PATH.

1. Right click on My Computer from the desktop.
2. Select properties.
3. Go to advanced.
4. Click environmental variables.
5. Under system variables select Path
6. Click edit.
7. Add ; and then where you installed Java to. Like if it was C:/Program Files/Java then you would add ;C/Program Files/Java to the end of what is already there. Do not delete what is already there.


A pretty simple Java editor, and I think it comes with a compiler and everything is Crimson Editor. Not sure if its free, you might want to look into it.

Author:  Aziz [ Thu Jun 30, 2005 9:33 am ]
Post subject: 

I good one (the one I use) is JCreator...it's pretty nice, and small file too. Google it up, it's free.

Oh and I might be out of my mind, but did you click the "compile" button before you clicked "run"?

Author:  Kyle [ Thu Jun 30, 2005 12:20 pm ]
Post subject: 

Ok thanks for all your help guys. I downloaded Jcreator and its simple and easy thanks Very Happy Very Happy Very Happy Very Happy . I used the code
code:
/**
 * The HelloWorldApp class implements an application that
 * simply displays "Hello World!" to the standard output.
 */
class HelloWorldApp {
    public static void main(String[] args) {
        System.out.println("Hello World!"); //Display the string.
    }
}

This is the same original code that was giving me the problems in the firs place with Netbeans. So it probly was a setting error on my part. Thanks for the help guys Very HappyVery Happy. Laughing 8) Exclamation

Author:  rizzix [ Thu Jun 30, 2005 7:17 pm ]
Post subject: 

yes.. as i suggested... it's a netbeans project settings issue..

nevertheless wtd and I have been driving the point that all beginners should start out with the command line. not only because it is easier to use for the beginners and that it lacks all the unnecessary complications of some IDE's.. but also, it is infact a necessary requirement to be fimiliar with the basic command line tools for any java programmers (actually any developer of any sort)... seriously if you didn't know how to compile a simple .java files using the standard tools.. well lets just say i'd consider you worse than a noob hehe Very Happy .. so yea.. just... try and get ur self fimiliar with them.. Wink

Author:  Kyle [ Thu Jun 30, 2005 9:56 pm ]
Post subject: 

ok.....
ps im far from a noob. Twisted Evil Very Happy Very Happy Very Happy

Author:  Aziz [ Fri Jul 01, 2005 12:03 am ]
Post subject: 

*noob* I've tried it, about a year ago, then had NetBeans, then got into school so java go byebye. Now I use Jcreator, though Razz I'm sure I could, given about an hour, get the hang of command-line

Author:  Spartan_117 [ Fri Jul 08, 2005 12:33 pm ]
Post subject: 

this is probably real stupid, or i just missed something , but wut do u guys mean by Command Line?

Author:  [Gandalf] [ Fri Jul 08, 2005 1:38 pm ]
Post subject: 

Ever heard of DOS? It's what you get when you go to "command prompt" in the start menu - the black screen outputting the current directory. You can do a heck of a lot on it if you know how to use it. "a heck of a lot" includes compiling and executing programs for most languages.

*stupid windows brainwashing people...*

Author:  Spartan_117 [ Sat Jul 09, 2005 9:19 am ]
Post subject: 

thats wut ur talking about??? lol well i kno wut the Windows Command Line is, but how do u Run Java Programs on it?

Author:  Aziz [ Sat Jul 09, 2005 9:39 am ]
Post subject: 

Here, I think you should read this:

http://java.sun.com/docs/books/tutorial/getStarted/cupojava/index.html


: