|
-
Feb 24th, 2001, 01:53 PM
#1
Thread Starter
Addicted Member
Hi, I have just recently started studying Java and therfore not to sure about solving these problems because the whole language is pretty strange to me (it’s the ugliest language I’ve come across so far!!!), any way the thing is when I try to compile my program I get the following error:
'Exception in thread "main" Java.lang.NoClassDefFoundError: Welcome1/Class'
I usually run them at uni and have no problem but I have just downloaded J2SDK from sun's web site and installed it and that's the error I get. Am I missing something? Any help would be appreciated
!!!THANKS IN ADVANCE!!!
-
Feb 24th, 2001, 02:02 PM
#2
Monday Morning Lunatic
What package did you put it in? Did you try and run using just
java Welcome1
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Feb 24th, 2001, 02:04 PM
#3
Basically, for an app, it's like this:
create/edit:
YourClass.java
public class YourClass{
public static void main(String[] args){
System.out.println("YourClass app ran");
}
}
compile with:
javac YourClass.java
run with:
java YourClass
-
Feb 24th, 2001, 03:32 PM
#4
Thread Starter
Addicted Member
parksie what do you mean what package did I put it in. I just install the J2SDK 1.3 on c:\
when I compile I go to DOS Prompt and enter
'C:\jdk1.3\bin> javac c:\welcome.java'
This is right isn't it?
Then when I run I do
'C:\jdk1.3\bin> java c:\welcome.java'
or
'C:\>java welcome.class'
Another thing VirtuallyVB has put '[]' after the String part in void main method but in my book they appeare after args, is there a difference?
-
Feb 24th, 2001, 04:33 PM
#5
Thread Starter
Addicted Member
Never mind guys I fixed it, I created a jdk.bat file to execute the following
Set path=%path%;C:\jdk1.3\bin
Set classpath=%classpath%;.
Now I can more or less call/run the files from anywhere and they compile and execute OK.
!!!THANKS FOR YOUR HELP ANYWAY GUYS!!!
-
Feb 24th, 2001, 06:04 PM
#6
When you run the application, parkie's and my point was that you DO NOT use a file extension.
'C:\jdk1.3\bin> java c:\welcome'
or
'C:\>java welcome'
java(.exe) actually references welcome.class when you do this.
In the main method, you can have (String anyName[])
or (String[] anyName)
Packages are slightly more advanced, but you do have to understand paths for that.
-
Mar 25th, 2001, 10:17 PM
#7
Lively Member
VisualBasic5.0ServicePack3
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|