• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

package does not exist

 
majid nakit
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15495
43
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).
 
majid nakit
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15495
43
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks lot,
I appreciate your helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic