Not 2 Suspicious

Hello and welcome to Not2Suspicious!
It seems that you are either not registered or are not currently loged in.
If you wish to log in or register click one of the buttons below!
Thanks!
Not 2 Suspicious

The 'Pot' For The 'Kool' Kids

Latest topics

» Take a look at the Fine staff of our skool.
Thu Apr 09, 2009 6:45 pm by TheSyphen

» I request.... a new and better principle
Mon Apr 06, 2009 8:39 pm by TheSyphen

» Hakz
Mon Apr 06, 2009 8:39 pm by TheSyphen

» School Holidays Start!
Mon Apr 06, 2009 8:39 pm by TheSyphen

» Post Boosting!
Mon Apr 06, 2009 8:39 pm by TheSyphen

» Suggestestions
Thu Apr 02, 2009 12:37 pm by Jayden

» Were Back Online!
Wed Apr 01, 2009 11:17 pm by Jayden

» Music
Wed Mar 04, 2009 12:50 pm by Jayden

» has anyone else had this problem?
Tue Mar 03, 2009 9:12 pm by Anonymous

Top posters

TheSyphen
 
Jayden
 
Hacker
 
ScreamingFreak
 
z0mgwtfbbq?
 
Sheafie
 
-MIRRORtoTHEmoon-
 
Revan.
 
Paperz
 
MAT
 

Rss feeds

Yahoo! 
Google Reader 
MSN 
AOL 
NewsGator 
Rojo 
Bloglines 
  • Post new topic
  • Reply to topic

The Hello World Application! (Basic Java Scripting)

Share

z0mgwtfbbq?
Mod!
Mod!

Male
Number of posts: 119
Age: 15
Location: Not telling, but don\'t look in your closet.
Awsumesause: 438
Rep: 0
Registration date: 2008-07-24

AwesumSause
Comment:
ASP: 0

The Hello World Application! (Basic Java Scripting)

Post by z0mgwtfbbq? on Sun Feb 01, 2009 10:14 pm

Okay, I'm back! I got bored and decided to create a guide to the HelloWorld Application for Java. Hope its not too bad o.O.

To write the Hello World Application you will need the following:

The latest release of the Java SE Development Kit. If you don't already have it, you can download it Here




Other then that, all you need is a basic text editor, such as notepad.

About the Application and what you will be Required to do:

The application you will create will simply display the words "Hello world!" in the CMD Window.

There are Three steps:

Create Source File
(The code, written in JavaScript)

Compile the Source File into a .Class file
You will use a Java language compiler supplied in The Java SE Developement kit to translate the code into instructions (Bytecodes).

Run the Program!
If you don't get this one, your an idiot.


The First step:
(Creating the Source File)

1. Open your text editor. (EG. Notepad) And in a new document type (Or Copy and Paste, like the lazy a*** you are) the following piece of coding:

Code:
/**
 * 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.
    }
}


Note: Type everything as shown, or you'll regret it. Java is case sensitive, and mis-spelling something is obviously going to be a problem.

2. Save the code with the following name: HelloWorldApp.java. (overwrite the default save-as name, the whole thing)

Once Saved, remember where you saved it and close the editor.

The Second Step!
(Compiling the Source File)

1. Bring up a shell, or CMD window. If your such a dumbass as to not even know wth that is,
Go to Start>Run and type 'cmd' (Windows XP)
OR
Start and type cmd, then click on the only search result (Windows Vista)

When you open it it should be in your computers home directory.

2. To compile the Source File we will need to manuever to the location you stored your HelloWorldApp.java file in. To do this, type in: cd 'file location'
(eg. cd 'C:\Java' if you saved it under C:\Java)
The prompt should now change to the location of your saved file.
Now type 'dir' and press enter, you should see your file, as well as a tonne of mumbo-jumbo about it. You know know you are in the right directory.

3. Now you should be ready to compile the file. (Hey! That rhymes...)

Type the following into the command prompt: javac HelloWorldApp.java

The compiler (javac) has generated a bytecode files which should be named 'HelloWorldApp.class'. To see this, type dir again and look for a .class file.

If you get the following error message: ''javac' is not recognized as an internal or external command, operable program or batch file' Windows cannot find the compiler. It get's a little tricky here. If this occured refer to the end of my tutorial.

Step Three!!
(The final step)

In the same directory, after you have filed the .class file type the following to execute your program: java HelloWorldApp

The program prints 'Hello World!' To the screen.

You may now bathe in chocolate, your program works!

If it doesn't please tell me any Problems you have encountered.





******************
''javac' is not recognized as an internal or external command, operable program or batch file'

As said before, windows can't find the compiler (javac). This could be one of two reasons.

1. Your download of the SE Developement kit failed, and you were the victem. Before you try to download it again, check the following directory and look for an .EXE file named 'javac'

C:\Program Files\Java\jdk1.6.0_11\bin (this is default location of the download, for the love of god I hope you didn't screw with it)

If you can the file 'Javac' Refer to the 2nd possible reason. If not, try reinstalling The Java Developement Kit.

2. This one is the fun one. You have the .EXE file but your computer is a dumbass and doesn't know where it is. In this case we will have to tell it where to find it by adding a User and System Variable. Follow the following instructions carefully.

Click Start > Control Panel > System (On XP)
Click Advanced > Environment Variables
Create a new variable in User variables and add the location of the Bin folder where the Javac file is located (Typically C:\Program Files\Java\jdk1.6.0_11\bin) in 'Value' and put 'Javac' in 'Name'

Now down to System Variables.

In system variables scroll around until you find a variable called 'PATH'. Click on it, then click on edit. These are all the adresses of the variables in user variables, it tells the system just where to find them. As you can see the adresses are sperated by semicolons, we will be adding a new adress, so go to the end of the list and put a semicolon in, then the location of Javac (Typically C:\Program Files\Java\jdk1.6.0_11\bin) and press okay.

NOTE: There are NO Spaces in variables, so don't bother using them because it will screw everything up. If you used a space, delete it.

Okay, now you have added javac as a variable. Unfortunately new variables only affect the CMD windows opened after they have been made, so you will need to close the current prompt and repeat steps 2 and finally, proceed to step 3!
***********************

Wasn't that fun?
Evil or Very MadHere

Last edited by z0mgwtfbbq? on Tue Feb 03, 2009 7:45 pm; edited 4 times in total (Reason for editing : Link fix.)

TheSyphen
The One

Male
Number of posts: 749
Age: 15
Location: Behind you...
Awsumesause: 538
Rep: 0
Registration date: 2008-07-24

Re: The Hello World Application! (Basic Java Scripting)

Post by TheSyphen on Mon Feb 02, 2009 7:03 pm

Nice, i won't be java scripting any time soon though. Lmao.


_________________
"I'm your dream, make you real
I'm your eyes when you must steal
I'm your pain when you cant feel
Sad but true"
Metallica - Sad But True

Jayden
asdf
asdf

Male
Number of posts: 388
Age: 16
Awsumesause: 594
Rep: 0
Registration date: 2008-07-23

Re: The Hello World Application! (Basic Java Scripting)

Post by Jayden on Tue Feb 10, 2009 10:37 am

Dito


_________________
One day there was chicken.
My nextdoor neighbor shot the chickens head off.
The End!

TheSyphen
The One

Male
Number of posts: 749
Age: 15
Location: Behind you...
Awsumesause: 538
Rep: 0
Registration date: 2008-07-24

Re: The Hello World Application! (Basic Java Scripting)

Post by TheSyphen on Tue Feb 10, 2009 5:38 pm

no, its ditto. You fail


_________________
"I'm your dream, make you real
I'm your eyes when you must steal
I'm your pain when you cant feel
Sad but true"
Metallica - Sad But True

Jayden
asdf
asdf

Male
Number of posts: 388
Age: 16
Awsumesause: 594
Rep: 0
Registration date: 2008-07-23

Re: The Hello World Application! (Basic Java Scripting)

Post by Jayden on Tue Feb 10, 2009 8:56 pm

Ditto.


_________________
One day there was chicken.
My nextdoor neighbor shot the chickens head off.
The End!

TheSyphen
The One

Male
Number of posts: 749
Age: 15
Location: Behind you...
Awsumesause: 538
Rep: 0
Registration date: 2008-07-24

Re: The Hello World Application! (Basic Java Scripting)

Post by TheSyphen on Tue Feb 10, 2009 9:48 pm

You still fail.


_________________
"I'm your dream, make you real
I'm your eyes when you must steal
I'm your pain when you cant feel
Sad but true"
Metallica - Sad But True

ScreamingFreak
Mod!
Mod!

Male
Number of posts: 169
Age: 15
Location: I'm in your head whispering evil little things to you
Awsumesause: 329
Rep: 0
Registration date: 2009-02-05

Re: The Hello World Application! (Basic Java Scripting)

Post by ScreamingFreak on Wed Feb 11, 2009 9:15 am

can I ditto something 2?


_________________


TheSyphen
The One

Male
Number of posts: 749
Age: 15
Location: Behind you...
Awsumesause: 538
Rep: 0
Registration date: 2008-07-24

Re: The Hello World Application! (Basic Java Scripting)

Post by TheSyphen on Wed Feb 11, 2009 9:19 am

NO GTFO!


_________________
"I'm your dream, make you real
I'm your eyes when you must steal
I'm your pain when you cant feel
Sad but true"
Metallica - Sad But True

Jayden
asdf
asdf

Male
Number of posts: 388
Age: 16
Awsumesause: 594
Rep: 0
Registration date: 2008-07-23

Re: The Hello World Application! (Basic Java Scripting)

Post by Jayden on Thu Feb 12, 2009 9:30 am

Ditto.


_________________
One day there was chicken.
My nextdoor neighbor shot the chickens head off.
The End!

TheSyphen
The One

Male
Number of posts: 749
Age: 15
Location: Behind you...
Awsumesause: 538
Rep: 0
Registration date: 2008-07-24

Re: The Hello World Application! (Basic Java Scripting)

Post by TheSyphen on Thu Feb 12, 2009 4:32 pm

. . .


_________________
"I'm your dream, make you real
I'm your eyes when you must steal
I'm your pain when you cant feel
Sad but true"
Metallica - Sad But True
  • Post new topic
  • Reply to topic

Current date/time is Thu Nov 26, 2009 8:22 pm