• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

please help me to resolve this

 
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
C:\Other Stuff\MyFirst\Threads1.java:10: cannot access Thread
bad class file: .\Excerpt from Java.Lang.Thread.java
file does not contain class Thread
Please remove or make sure it appears in the correct subdirectory of the classpath.
Thread T1 = new Thread(r);
^
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you post more of the actual code?
 
Ranch Hand
Posts: 284
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you paste up your program here?
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Seems like you have a file named Thread.java somewhere on your classpath. It's name conflicts with the java.lang.Thread which is implicitly imported in every Java class.
 
Sid Robin
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
class TestMyThread extends Thread {


}

****************************************************************************
I Executed the above program and got the error which am facing for the first time Please help me to resolve this
****************************************************************************

C:\Other Stuff\MyFirst\Excerpt from Java.Lang.Thread.java:3: class Thread is public, should be declared in a file named Thread.java
public class Thread implements Runnable
^
C:\Other Stuff\MyFirst\TestMyThread.java:1: cannot access Thread
bad class file: C:\Other Stuff\MyFirst\Excerpt from Java.Lang.Thread.java
file does not contain class Thread
Please remove or make sure it appears in the correct subdirectory of the classpath.
class TestMyThread extends Thread {
^

Tool completed with exit code 1

****************************************************************************
 
Sergey Petunin
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Looks like all you have to do is to remove or rename the file
"C:\Other Stuff\MyFirst\Excerpt from Java.Lang.Thread.java"
It's name clashes with the Thread class file name.
 
Sid Robin
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Got it guys

Very silly mistake i admit

Thanks a lot dude
 
She still doesn't approve of my superhero lifestyle. Or this shameless plug:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic