Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.lang package is not importing by default

 
ravi kanth
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
i am new to java.
in my Sample Code i am getting this compilation error,even after setting path,classpath too,

" file does not contain class String
please remove are make sure it appears in the correct subdirectoryof the classpath "

Thanks & regards
raja.
 
sudipto shekhar
Ranch Hand
Posts: 823
Chrome Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Posting the code along with the problem would be great.
Thank you.
 
Campbell Ritchie
Sheriff
Posts: 48454
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't usually need to set a classpath for a beginner's application.
 
ravi kanth
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi this my Code:
[edit]Add code tags[/edit]
[ November 25, 2008: Message edited by: Campbell Ritchie ]
 
Campbell Ritchie
Sheriff
Posts: 48454
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please always Use Code Tags; I have added them so you can see how much better your post looks.

I haven't seen that error before. Please check your PATH is correct. Please check you don't have any Java installation folders in your CLASSPATH; for a simple application like that it is not necessary to have anything in your CLASSPATH at all. If you have a decent internet connection, try reinstalling Java and update the PATH if you have a new installation location.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15208
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the name of your source file? Did you call it String.java? That doesn't work.

In Java, the source file must have the name of the public class (or interface) in the file, so if you have a public class MyThread then the source file must be named MyThread.java.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic