Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-24-2007, 09:30 AM
Member
 
Join Date: Jul 2007
Posts: 1
sathish04021984 is on a distinguished road
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
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-24-2007, 05:15 PM
Member
 
Join Date: Jul 2007
Posts: 32
valery is on a distinguished road
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.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-25-2007, 06:46 PM
Member
 
Join Date: Jul 2007
Posts: 8
mirage_87 is on a distinguished road
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....
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 07-30-2007, 10:26 AM
Member
 
Join Date: Jul 2007
Posts: 72
Swamipsn is on a distinguished road
For avoid this kind of problem please set up a class path in environmental variable list
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to execute an External Program through Java program Java Tip java.io 0 04-04-2008 03:40 PM
Poblem in Compiling a c++ file from a java program... Amit Kr. Mishra New To Java 0 11-06-2007 11:41 AM
How to execute an External Program through Java program JavaBean Java Tips 0 10-04-2007 10:33 PM
problem compiling servlets boy22 Java Servlet 1 08-03-2007 11:05 AM
a problem about java mail client program lunarstyle AWT / Swing 6 06-02-2007 12:43 AM


All times are GMT +3. The time now is 11:10 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org