Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SimpleDateFormat and Timestamp does not exist in the 1.6 JDK (1.6.0_18)

807580Mar 11 2010 — edited Mar 11 2010
I am trying to compile a program with SimpleDateFormat and I get "cannot find symbol". I'm using Netbeans and Maven and in Netbeans, the software finds the correct import java.text.SimpleDateFormat, so it's not a question of the definitions not being there, it's the compiled classes that are missing somehow.

Any ideas what could be the problem?

My classpath:
CLASSPATH=.;C:\Program\Java\jdk.1.6.0_18\jre\lib\resources.jar;C:\Program\Java\jdk1.6.0_18\jre\lib\rt.jar;C:\Program\Java\jdk1.6.0_18\jre\lib\sunrsasign.jar
I reinstalled both netbeans and the JDK (after first uninstalling them, then removing any remaining files manually and then rebooting my computer).

This simple application demonstrates the problem:
import java.text.DateFormat;
import java.text.SimpleDateFormat;

public class DatabaseBuilder 
{
    private DateFormat m_formatter;
    
    public DatabaseBuilder()
    {
        m_formatter = SimpleDateFormat( "yyy-MM-dd HH:mm:ss" );
    }
}
Resulting output:
DatabaseBuilder.java:10: cannot find symbol
symbol  : method SimpleDateFormat(java.lang.String)
location: class DatabaseBuilder
        m_formatter = SimpleDateFormat( "yyy-MM-dd HH:mm:ss" );
                      ^
1 error
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 8 2010
Added on Mar 11 2010
13 comments
2,201 views