• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Eclipse IDE and jars

 
Mirrell Knabe
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All -

I was getting an error that javax.persistence.* was not found in all of my classes in Eclipse, so I dragged and dropped the jpa.jar file into the the project folder where all the other jars are....seemed to fix the problem - resolved all errors, BUT when I close and relaunch Eclipse the errors are back, BUT the jpa.jar file is still there....Any ideas why relaunching Eclipse is causing the jpa.jar to not be recognized?

Thanks.
Mirrell
 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you adding JARs like this:
[t]Project > Properties > Java Build Path > Libraries > Add external jars[/t]
?
 
Mirrell Knabe
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sagar....I am not...I tried two different ways: 1.) File -> Import -> Archived JAR and 2.) Dragging and dropping it in the project directory containing all jars....I think what your saying is the buildpath is not getting updated?....I will try the way you suggest....Thanks!
 
Mirrell Knabe
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sagar -

That worked beautifully...Thank You!...Let me ask what is the difference between your method and doing a File -> Import -> JAR.....?

Thanks,
Mirrell

 
Sagar Rohankar
Ranch Hand
Posts: 2907
1
Java Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mirrell Knabe wrote:Let me ask what is the difference between your method and doing a File -> Import -> JAR.....?

Honestly, I don't know. I do import whenever I want to import an Eclipse project into my workspace, thats all I do using Import and when you add jar/libraries into a Java Build Path, Eclipse add the CLASSAPTH setting for that JAR in your project for you. Check the CLASSPATH file in your project directory for the same.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using "File Import->Archive File" will extract the content of the archived file, which means that it will copy the files from the JAR, into your project. You should never do that. JAR files should be added in the classpath, the way Sagar explained.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic