File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes package does not exist Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "package does not exist" Watch "package does not exist" New topic
Author

package does not exist

majid nakit
Ranch Hand

Joined: Jun 26, 2001
Posts: 164
Hi,

I have these two forlders :

C:\Majid\Javapractices\STAX\de\vogella\xml\stax\model
that has :
Item.java

and

C:\Majid\Javapractices\STAX\de\vogella\xml\stax\read
that has :
StaXParser.java
TestRead.java

when I do :

C:\Majid\Javapractices\STAX\de\vogella\xml\stax\read>javac TestRead.java
TestRead.java:5: package de.vogella.xml.stax.model does not exist
import de.vogella.xml.stax.model.Item;
^
TestRead.java:9: cannot find symbol
symbol : class StaXParser
location: class de.vogella.xml.stax.read.TestRead
StaXParser read = new StaXParser();
^
TestRead.java:9: cannot find symbol
symbol : class StaXParser
location: class de.vogella.xml.stax.read.TestRead
StaXParser read = new StaXParser();
^
TestRead.java:10: cannot find symbol
symbol : class Item
location: class de.vogella.xml.stax.read.TestRead
List<Item> readConfig = read.readConfig("config.xml");
^
TestRead.java:11: cannot find symbol
symbol : class Item
location: class de.vogella.xml.stax.read.TestRead
for (Item item : readConfig) {
^
5 errors


Can you please help me.

Thanks


Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14146
    
  18

You have to be at the right place in the directory tree. Try this:

C:\Majid\Javapractices\STAX> javac -cp . de\vogella\xml\stax\read\TestRead.java

C:\Majid\Javapractices\STAX> java -cp . de.vogella.xml.stax.read.TestRead


(note the -cp . is to put the current directory in the classpath).


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
majid nakit
Ranch Hand

Joined: Jun 26, 2001
Posts: 164
Hi Jesper,

I did it, but did not work :

C:\Majid\Javapractices\STAX\de\vogella\xml\stax>javac -cp . de\vogella\xml\stax\
read\TestRead.java
javac: file not found: de\vogella\xml\stax\read\TestRead.java
Usage: javac <options> <source files>
use -help for a list of possible options

Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14146
    
  18

Because you are in the wrong directory.

Please read the commands and error messages and try to understand what the command is going to do, or what the error message means.

You are in the directory C:\Majid\Javapractices\STAX\de\vogella\xml\stax and then you try to compile the file de\vogella\xml\stax\read\TestRead.java

It is ofcouse going to look for a file named C:\Majid\Javapractices\STAX\de\vogella\xml\stax\de\vogella\xml\stax\read\TestRead.java
(note the directory names).

Make sure you are in the directory C:\Majid\Javapractices\STAX and not C:\Majid\Javapractices\STAX\de\vogella\xml\stax
majid nakit
Ranch Hand

Joined: Jun 26, 2001
Posts: 164
Thanks lot,
I appreciate your helps.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: package does not exist