Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Meherdad Bomanbehram
Ranch Hand
Posts: 142
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 198
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you need to include all the jar files that comes with your app server into your classpath enviroment variable
 
Meherdad Bomanbehram
Ranch Hand
Posts: 142
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Dinuka
Does any one know which jars and where they are .
 
Dustin Johnson
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Meherdad Bomanbehram
Ranch Hand
Posts: 142
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Couldn't tell you that one, never actually done it myself!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic