This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes problem with packages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "problem with packages" Watch "problem with packages" New topic
Author

problem with packages

peter maw
Greenhorn

Joined: Jan 24, 2005
Posts: 2
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
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093


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).


42
peter maw
Greenhorn

Joined: Jan 24, 2005
Posts: 2
Thx Jeroen!

All sorted...I think
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem with packages
 
Similar Threads
package....
Importing Packages & Classpath
how to write jar file
NoClassDefFoundError
Package and Classpath problem