This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Hands On Software Engineering with Python and have Brian Allbey on-line!
See this thread for details.
Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!
  • 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

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.
 
Fire me boy! Cool, soothing, shameless self promotion:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!