• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problem with packages

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,

New to Java and trying very hard... but not making much progress..

I am trying to import a package. The code is ....

import package com.javaranch.common.*;

My class file is in "E:\java\Myjava"

and the package is stored in "E:\java\Myjava\com\javaranch\common"

I have double checked my classpath and the spelling,etc, and the import statement is the first line in my source file.

When I try to compile, I get two errors:

"<identifier> expected" and " '.' expected "

Any help would be greatly appreciated.

Thx in advance


Herbie
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


What are you trying to achieve here, an import or a package declaration?
In either case your code is wrong.

Use either

OR
(and the second is highly discouraged as you're not the maintainer of the package, you should put classes in packages of your own, not those of others).
 
peter maw
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thx Jeroen!

All sorted...I think
 
reply
    Bookmark Topic Watch Topic
  • New Topic