Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-03-2002, 11:21 PM   PM User | #1
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
Java question

I'm wanting to have a go at java. I've been trying to get the SDK from the java sun site, but everytime I finally download it, it gives me an error, about it being corrupt. So, can I use any other java programs that does the same as this SDK program? As you can see, I don't know what it does, I just read that I need it to compile applets.
__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks
Nightfire is offline   Reply With Quote
Old 09-04-2002, 06:44 PM   PM User | #2
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
Ok, I got the jdk1.1.8 but every time I'm trying to compile it, it's saying:

Quote:
error: Can't read: HelloWorldApp.java
1 error
Here's the command I'm typing in DOS:

Quote:
C:\>jdk1.1.8\bin\javac HelloWorldApp.java
I put the HelloWorldApp.java file in the bin directory too. Can anyone help me?

My java code is:

Code:
public class HelloWorldApp {
    public static void main(String[] args) {
        // Display "Hello World!"
        System.out.println("Hello World!");
    }
}
__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks
Nightfire is offline   Reply With Quote
Old 09-05-2002, 02:20 AM   PM User | #3
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
Nevermind, I'll just stick to php
__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks
Nightfire is offline   Reply With Quote
Old 09-05-2002, 10:52 PM   PM User | #4
Spookster
Supreme Overlord


 
Spookster's Avatar
 
Join Date: May 2002
Location: Marion, IA USA
Posts: 6,234
Thanks: 4
Thanked 81 Times in 80 Posts
Spookster will become famous soon enough
Try this:

Code:
class HelloWorldApp {
    public static void main(String[] args) {
        // Display "Hello World!"
        System.out.println("Hello World!");
    }
}
To compile:

javac HelloWorldApp.java

To run it:

java HelloWorldApp


And yes you should put that file in the bin directory unless you have set up classpaths to point to somewhere else.
__________________
Spookster
CodingForums Supreme Overlord
All Hail Spookster
Who gave you that Ugging infraction? Yeah that's right it was me!
Spookster is offline   Reply With Quote
Old 09-05-2002, 11:07 PM   PM User | #5
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
Thanks that worked. What does the "public" mean on the first line?
__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks
Nightfire is offline   Reply With Quote
Old 09-06-2002, 04:39 PM   PM User | #6
hairynugs6382
Regular Coder

 
Join Date: Aug 2002
Location: Sacramento, California
Posts: 132
Thanks: 0
Thanked 0 Times in 0 Posts
hairynugs6382 is an unknown quantity at this point
is it just me or is it similar to c++
java looks almost the same i did not know that java was even compiled language!
__________________
Hairynugs


Simple is best.
hairynugs6382 is offline   Reply With Quote
Old 09-06-2002, 04:52 PM   PM User | #7
bcarl314
Mega-ultimate member


 
Join Date: Jun 2002
Location: Winona, MN - The land of 10,000 lakes
Posts: 1,855
Thanks: 1
Thanked 45 Times in 42 Posts
bcarl314 will become famous soon enough
Quote:
Originally posted by Nightfire
Thanks that worked. What does the "public" mean on the first line?
Public means that the methods within the class can be accessed by other classes.
bcarl314 is offline   Reply With Quote
Old 09-06-2002, 05:50 PM   PM User | #8
Nightfire
Senior Coder

 
Nightfire's Avatar
 
Join Date: Jun 2002
Posts: 4,266
Thanks: 6
Thanked 48 Times in 48 Posts
Nightfire is on a distinguished road
Ahh, ok Thanks
__________________
Blue Panda
Website Design | 1 Pound Ads | 'ow much? | Coding Geeks
Nightfire is offline   Reply With Quote
Old 09-06-2002, 07:21 PM   PM User | #9
Spookster
Supreme Overlord


 
Spookster's Avatar
 
Join Date: May 2002
Location: Marion, IA USA
Posts: 6,234
Thanks: 4
Thanked 81 Times in 80 Posts
Spookster will become famous soon enough
Yes "public" is an access identifier. You also have "private". These come in handy when creating packages and instantiable classes where you only want to give access to certain methods or variables.

Yes Java is a compiled language; not to be confused with Javascript. And yes Java is very similar to C++ as far as syntax.
__________________
Spookster
CodingForums Supreme Overlord
All Hail Spookster
Who gave you that Ugging infraction? Yeah that's right it was me!
Spookster is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:23 AM.


Advertisement
Log in to turn off these ads.