• 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
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

package does not exist

 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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


 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks lot,
I appreciate your helps.
 
I like tacos! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic