Author |
Message |
|
Arcane Wizard `semi-hippie`
Super Elite (Last Title)
Joined: 02 Jun 2003 Posts: 8993
|
Posted: 30 Aug 2004 09:44:12 am Post subject: |
|
|
Installed the SDK (1.3.1) yesterday, JBuilder works fine but I want to write my applets with notepad and compile them with javac.
HELLO_WORLD.java
import java.applet.*;
import java.awt.*;
public class HELLO_WORLD extends Applet {
public void paint(Graphics g) {
g.drawString("Hello world!", 50, 25); //draws an overused string of characters
}
}
When I try to compile:
javac HELLO_WORLD.java -O
HELLO_WORLD.java:4: class HELLO_WORLD is public, should be declared in a file named HELLO_WORLD.java
public class HELLO_WORLD extends Apllet {
^
1 error
ARG!! I AM DECLARING IT!! IT IS IN A FILE CALLED HELLO_WORLD.java!!
help?
I also tried javac HELLO_WORLD.java without the -O and I tried JDK 1.4.2
Last edited by Guest on 30 Aug 2004 10:01:00 am; edited 1 time in total |
|
Back to top |
|
|
JoeImp Enlightened
Active Member
Joined: 24 May 2003 Posts: 747
|
Posted: 30 Aug 2004 10:10:29 am Post subject: |
|
|
I haven't used java for at least 2 years, so I can't really help. Gotta learn it again sometime though, for college . Anyways, if you're typing all this in notepad, make sure you went file->save as, then click all types, and saved it as a .java. In otherwords, it could say "hello_world.java" as the file name, but still be a .txt file. It would then be hello_world.java.txt. Kinda wierd isn't it? You probly already know this, but it's the best I can do. Sorry
Imp |
|
Back to top |
|
|
leofox INF student
Super Elite (Last Title)
Joined: 11 Apr 2004 Posts: 3562
|
Posted: 30 Aug 2004 10:26:20 am Post subject: |
|
|
yeah, that's annoying, and the stupid thing is that windows doesn't show the extension of known files. You probably already know this Arcane, but you can show all the extensions by clicking Extra/Mapoptions/View/ then uncheck "hide known extensions".
I've had problems like that when "programming" in HTML. (huh? why does it open like a text file and not like a website??? )
Last edited by Guest on 30 Aug 2004 10:27:43 am; edited 1 time in total |
|
Back to top |
|
|
Arcane Wizard `semi-hippie`
Super Elite (Last Title)
Joined: 02 Jun 2003 Posts: 8993
|
Posted: 30 Aug 2004 10:39:24 am Post subject: |
|
|
Yeah I already knew that, I made the file by right clicking->new..->txt file and changing the file's name and extension to HELLO_WORLD.java and then I wrote the code.
Also, "Extra/Mapoptions" does not exist, it's either "Extra/Mapopties" for Dutch users or "Tools/Folder Options" for UK/US users, and the selectable function is called "Hide extensions for known file types."
Oh, and it's not stupid at all that it's selected by default.
Last edited by Guest on 30 Aug 2004 10:41:08 am; edited 1 time in total |
|
Back to top |
|
|
leofox INF student
Super Elite (Last Title)
Joined: 11 Apr 2004 Posts: 3562
|
Posted: 30 Aug 2004 10:50:26 am Post subject: |
|
|
I literally translated the Dutch menu names
well, you know what i mean anyway.
hatless wizard wrote: Oh, and it's not stupid at all that it's selected by default.
sarcasm? |
|
Back to top |
|
|
Arcane Wizard `semi-hippie`
Super Elite (Last Title)
Joined: 02 Jun 2003 Posts: 8993
|
Posted: 30 Aug 2004 10:59:44 am Post subject: |
|
|
leofox wrote: I literally translated the Dutch menu names
well, you know what i mean anyway.
Yeah, I knew what you ment, but English members might not since they don't use the word "map" for folders and directories.
Quote: hatless wizard wrote: Oh, and it's not stupid at all that it's selected by default. sarcasm? Nope, it's pretty useless to have it show all extensions when it already tells you what kind of a file it is in text and the file's icon. I do like having it show them anyway though, personal preference.
Oh, Java works now, didn't change anything though, wierd.
Last edited by Guest on 30 Aug 2004 12:25:17 pm; edited 1 time in total |
|
Back to top |
|
|
optimize
Advanced Newbie
Joined: 03 Aug 2004 Posts: 99
|
Posted: 31 Aug 2004 09:40:16 pm Post subject: |
|
|
Try removing the underscore, that might confuse it...?
Anyways I always use Forte Community Edition (Old, might be hard to find)
Uses alot of memory (128MB+) but it has never failed me, full debugger and all!
(The old version is free) |
|
Back to top |
|
|
EEDOK
Member
Joined: 06 Mar 2004 Posts: 117
|
Posted: 31 Aug 2004 11:40:25 pm Post subject: |
|
|
it shouldn't need the word public.. |
|
Back to top |
|
|
Arcane Wizard `semi-hippie`
Super Elite (Last Title)
Joined: 02 Jun 2003 Posts: 8993
|
Posted: 01 Sep 2004 05:16:24 am Post subject: |
|
|
It already works without changing anything.
And it doesn't need to show a string either, or contain comments, or any use of the paint method, but it's still nice that doesn't mean I'm not allowed to program the thing the way I want to. |
|
Back to top |
|
|
EEDOK
Member
Joined: 06 Mar 2004 Posts: 117
|
Posted: 01 Sep 2004 02:35:09 pm Post subject: |
|
|
public class HELLO_WORLD extends Apllet {
Perhaps that's the real problem hidden behind the message?
Notepad works fine, but I still think nothing comes close to Eclipse when it comes to Java programming.. The compile as you code saves Tons! of time.. |
|
Back to top |
|
|
Arcane Wizard `semi-hippie`
Super Elite (Last Title)
Joined: 02 Jun 2003 Posts: 8993
|
Posted: 02 Sep 2004 02:59:28 am Post subject: |
|
|
Awesome, you found an error in the debugging error message, my source code is perfect:
public class HELLO_WORLD extends Applet {
public void paint(Graphics g) {
g.drawString("Hello world!", 50, 25); //draws an overused string of characters
}
} |
|
Back to top |
|
|
|