File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes java.lang package is not importing by default Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "java.lang package is not importing by default" Watch "java.lang package is not importing by default" New topic
Author

java.lang package is not importing by default

ravi kanth
Ranch Hand

Joined: Jun 04, 2008
Posts: 36
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

Joined: Apr 02, 2008
Posts: 823

Posting the code along with the problem would be great.
Thank you.


Regards, Sud.
SCJP 5 ScjpFAQ JLS
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38784
    
  23
You don't usually need to set a classpath for a beginner's application.
ravi kanth
Ranch Hand

Joined: Jun 04, 2008
Posts: 36
Hi this my Code:
[edit]Add code tags[/edit]
[ November 25, 2008: Message edited by: Campbell Ritchie ]
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38784
    
  23
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

Joined: Aug 16, 2005
Posts: 14144
    
  18

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.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.lang package is not importing by default