Results 1 to 4 of 4
- 07-24-2007, 08:30 AM #1
Member
- Join Date
- Jul 2007
- Posts
- 1
- Rep Power
- 0
getting problem in compiling java program?
C:\PROGRA~1\Java\JDK15~1.0\bin>javac sample.java
C:\PROGRA~1\Java\JDK15~1.0\bin>java sample
Exception in thread "main" java.lang.NoClassDefFoundError: sample
hi gays, can anyone help me? i do't know i am getting this problem while compiling the java programs, please anyone send me solutions to my id,
my id is "sathish04021984@gmail.com", plse send me gays:confused:
- 07-24-2007, 04:15 PM #2
Member
- Join Date
- Jul 2007
- Posts
- 32
- Rep Power
- 0
java cannot find your bytecode file, sample.class
One of the places java tries to find your .class file is your current directory. So if your .class file is in C:\java, you should change your current directory to that. To change your directory, type the following command at the prompt and press Enter:
cd c:\java
The prompt should change to C:\java>. If you enter dir at the prompt, you should see your .java and .class files. Now enter java HelloWorldApp again.
If you still have problems, you might have to change your CLASSPATH variable. To see if this is necessary, try clobbering the classpath with the following command.
set CLASSPATH=
Now enter java sample again. If the program works now, you'll have to change your CLASSPATH variable. To set this variable, consult the Update the PATH variable section in the JDK 6 installation instructions. The CLASSPATH variable is set in the same manner.
- 07-25-2007, 05:46 PM #3
Member
- Join Date
- Jul 2007
- Posts
- 8
- Rep Power
- 0
he is right ....but i guess other error u might have done cld be that yr class name isin't the same as the filename.
i mean if yr main class(the one havin the main() function ) has a different name than the one u gave to yr file it wld show similar error...
so if yr filename is : sample.java
yr classname shld be: sample
i guess this wld be help....
- 07-30-2007, 09:26 AM #4
Member
- Join Date
- Jul 2007
- Posts
- 74
- Rep Power
- 0
Similar Threads
-
a problem about java mail client program
By lunarstyle in forum AWT / SwingReplies: 9Last Post: 12-19-2009, 04:14 PM -
How to execute an External Program through Java program
By Java Tip in forum java.ioReplies: 0Last Post: 04-04-2008, 02:40 PM -
Poblem in Compiling a c++ file from a java program...
By Amit Kr. Mishra in forum New To JavaReplies: 0Last Post: 11-06-2007, 10:41 AM -
How to execute an External Program through Java program
By JavaBean in forum Java TipReplies: 0Last Post: 10-04-2007, 09:33 PM -
problem compiling servlets
By boy22 in forum Java ServletReplies: 1Last Post: 08-03-2007, 10:05 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks