wood burning stoves 2.0*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Help ...Cabin.java:3: package javax.persistence does not exist Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Help ...Cabin.java:3: package javax.persistence does not exist" Watch "Help ...Cabin.java:3: package javax.persistence does not exist" New topic
Author

Help ...Cabin.java:3: package javax.persistence does not exist

Meherdad Bomanbehram
Ranch Hand

Joined: May 28, 2007
Posts: 139

Hi all ,
I am using notepad to create my .java files so that I get through practice .
I compile using the cmd prompt .
the server I use is glassfish .
The example I am trying out are from the Enterprise JavaBeans 3.0 5th edition by O'Reilly.
the source code is as below


I tried to compile with

javac -d . Cabin.java


the Errors I got were

Cabin.java:3: package javax.persistence does not exist
import javax.persistence.*;
^
Cabin.java:5: cannot find symbol
symbol: class Entity
@Entity
^
Cabin.java:6: cannot find symbol
symbol: class Table
@Table(name="CABIN")
^
Cabin.java:15: cannot find symbol
symbol : class Id
location: class com.titan.domain.Cabin
@Id
^
Cabin.java:16: cannot find symbol
symbol : class Column
location: class com.titan.domain.Cabin
@Column(name="ID")
^
Cabin.java:20: cannot find symbol
symbol : class Column
location: class com.titan.domain.Cabin
@Column(name="NAME")
^
6 errors


Please could some one guide m as to what i should do . I do not want to use an IDE like netbeans / Eclipse as I want to practice what goes where .

Many Thanks
Dinuka Arsakularatne
Ranch Hand

Joined: Aug 12, 2006
Posts: 198
you need to include all the jar files that comes with your app server into your classpath enviroment variable


if who i am is what i have, and what i have is lost, then who am i?<br /> <br />SCJP 5.0<br />SCWCD 1.4<br />SCBCD preparing
Meherdad Bomanbehram
Ranch Hand

Joined: May 28, 2007
Posts: 139

Thanks Dinuka
Does any one know which jars and where they are .
Dustin Johnson
Greenhorn

Joined: Nov 14, 2006
Posts: 22
The jars you need to include are these:

commons-codec.jar
commons-httpclient.jar
commons-logging.jar
concurrent.jar
getopt.jar
jboss-common.jar
jboss-jmx.jar
jboss-system.jar
jboss-xml-binding.jar
log4j-boot.jar

These were located in my C:\Program Files\Jboss 4.2.2.GA\lib directory, so essentially the lib directory under your $JBOSS_HOME.


SCJA 86%<br />SCJP 5.0 98%<br />SCWCD 1.4 79%<br />SCBCD 5.0 83%<br />--------------------------------<br />"I drank what???" - Socrates
Meherdad Bomanbehram
Ranch Hand

Joined: May 28, 2007
Posts: 139

Thanks a million Dustin
I have done so now the client compiles but the database is not available so it errors out can you pls tell me how to set up the persistence.xml so that it looks at my SQL server database . also how do I configure the datasource .
Many thanks
Dustin Johnson
Greenhorn

Joined: Nov 14, 2006
Posts: 22
Couldn't tell you that one, never actually done it myself!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Help ...Cabin.java:3: package javax.persistence does not exist