• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

How do I import SimpleDateFormat?  RSS feed

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
bash-2.03$ cat TimeStamp.java

bash-2.03$ javac -verbose TimeStamp.java
[parsing started TimeStamp.java]
[parsing completed 221ms]
[loading /usr/local/home/Plankton/SUNWappserver/jdk/jre/lib/rt.jar(java/lang/Object.class)]
[loading /usr/local/home/Plankton/SUNWappserver/jdk/jre/lib/rt.jar(java/lang/String.class)]
[checking TimeStamp]

[loading /usr/local/home/Plankton/SUNWappserver/jdk/jre/lib/rt.jar(java/lang/System.class)]
[loading /usr/local/home/Plankton/SUNWappserver/jdk/jre/lib/rt.jar(java/io/PrintStream.class)]
[loading /usr/local/home/Plankton/SUNWappserver/jdk/jre/lib/rt.jar(java/io/FilterOutputStream.class)]
[loading /usr/local/home/Plankton/SUNWappserver/jdk/jre/lib/rt.jar(java/io/OutputStream.class)]
[total 1210ms]
2 errors
bash-2.03$ env | grep CLASS
[ edited to preserve formatting using the [code] and [/code] UBB tags -ds ]
[ February 15, 2004: Message edited by: Dirk Schreckmann ]
 
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sheldon
Use,
import java.text.*;
and you should be fine..
Regards
Maulin
 
Sheldon Plankton
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks! What should of clued me into the fact that I imported the wrong package? That's seems to be a source of frustration for me.
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Sheldon Plankton:
Thanks! What should of clued me into the fact that I imported the wrong package? That's seems to be a source of frustration for me.


A few things that might make your life less frustrating (in order of least time consuming):
1) Using an IDE that figures this stuff out for you (Eclipse is a great IDE and it's free)
2) Looking up package information in relavant code documentation
3) Googling for this type of info
I strongly recommend going with option 1) and using the rest as backups.
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As a new Java programmer is starting to learn the language and the standard libraries, I'd recommend not using a fancy IDE, which could hide some fundamental things that are good to know and understand. When the basics are understood and mastered, it's probably a safe and good time to move onto an advanced IDE.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!