Forum     

Go Back   Digit Technology Discussion Forum > Portables, Peripherals and Electronics > QnA (read only)
Register FAQ Calendar Mark Forums Read

QnA (read only) Mods please help transfer the contents of this forum to proper sections. :)


 
 
LinkBack Thread Tools Search this Thread Display Modes
Old 19-09-2005, 12:04 AM   #1 (permalink)
The No.1 Stupid
 
~Phenom~'s Avatar
 
Join Date: May 2005
Location: CYBERYARD
Posts: 1,708
Default java problem


hi friends ,
i m new to java and faced the following problem while running my first program


class First
{ public static void main(String args[])
{ System.out.println("welcome");
}
}

i have saved this program as First.java in bin directory

it gets compiled successfully with command javac First.java on command prompt but when i run this using java First it gives error saying
exception in thread "main" java.lang.NoclassDefFoundError:First

please help me , tell me where is the problem? n how to solve it?
__________________
n00b forever...
~Phenom~ is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 19-09-2005, 01:27 AM   #2 (permalink)
Right Off the Assembly Line
 
Manojap's Avatar
 
Join Date: Oct 2004
Location: India,kerala
Posts: 28
Default The java problem

You have to try this while compiling and running

javac first.java

then u have made the mistake.. may be u type class file name as small letter

try this
java First[do not use the .class extention]

U can find usefull java turorial on my blog take look and give me feed back

http://www.sourcecode-india.blogspot.com

Manoj A.P ,G-Tec Computer Education
Manojap is offline  
Old 19-09-2005, 11:10 AM   #3 (permalink)
Wise Old Owl
 
Join Date: Jul 2004
Location: Bangalore
Posts: 1,208
Default Re: The java problem

Quote:
Originally Posted by Manojap
You have to try this while compiling and running

javac first.java

then u have made the mistake.. may be u type class file name as small letter
Thats incorrect. How he compiled it is right. Java is case sensitive and hence he has specified the right.

Phenom:

Your problem is that although your class compiles it is not available for the java execuatable to execute. By this I mean that the .class file which gets generated would need to be in the classpath. The easiest way to do this would be to execute this command in the DOS window:

set CLASSPATH=.;%CLASSPATH%

What the above command does is to set the class path to the current directory and all sub directories. This setting will be available to this current window only. Which is useful if you move around directories a lot. Now run your java file:

java First

and it sould work.

Hope this helps. If you need any further help let me know and I'll see what I can do.
__________________
AMD 64 3500+ Venice
DFI Lan Party Ultra-D
2* 512 MB PdP Memory with 2-2-5L timings
XFX 7900GT 256 MB Card
icecoolz is offline  
Old 19-09-2005, 02:27 PM   #4 (permalink)
In The Zone
 
#/bin/sh's Avatar
 
Join Date: Apr 2004
Location: 42.65 N 73.76 W
Posts: 213
Default

what package is it in?
__________________
\"99 little bugs in the code, 99 bugs in the code, fix one bug, compile it again, 148 little bugs in the code. 148 little bugs in the code....\"
#/bin/sh is offline  
Old 19-09-2005, 11:08 PM   #5 (permalink)
The No.1 Stupid
 
~Phenom~'s Avatar
 
Join Date: May 2005
Location: CYBERYARD
Posts: 1,708
Default

thanx icecoolz
set CLASSPATH=.;%CLASSPATH%
worked
problem solved
thank u very much .
u must be a java genius coz i asked the same prob to all my teachers , colleagues ,etc. but no one could answer the sol.
i was so frustrated that i thought there is some problem in my PC and was about to format it and reinstall windows XP.
but thanx to you , u brought my smile back.
thank u.
__________________
n00b forever...
~Phenom~ is offline  
Old 20-09-2005, 11:23 AM   #6 (permalink)
Wise Old Owl
 
Join Date: Jul 2004
Location: Bangalore
Posts: 1,208
Default

lol...I aint no java genius. I just went thru the same pains which you did altho I did it seven years back And yea after being in the java field if I dont even know this then .... Gald to help mate.
__________________
AMD 64 3500+ Venice
DFI Lan Party Ultra-D
2* 512 MB PdP Memory with 2-2-5L timings
XFX 7900GT 256 MB Card
icecoolz is offline  
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On


 
Latest Threads
- by topgear
- by Charan

Advertisement




All times are GMT +5.5. The time now is 06:37 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2