Results 1 to 8 of 8
- 11-02-2009, 01:33 AM #1
Member
- Join Date
- Oct 2009
- Posts
- 6
- Rep Power
- 0
Error - "The import org.junit cannot be resolved"
I am getting the error message of: "The import org.junit cannot be resolved".
The lines of code that this refers to are:
import static org.junit.Assert.*;
import org.junit.Test;
I'm currently using Windows Vista, and I'm using Eclipse 3.5 Galileo, which I'm led to believe comes bundled with JUnit 4.
I'm not sure if that is enough information to help resolve the issue. Let me know if there's anything else you'd need to know.
I had been using Eclipse on a school's computer, and had been able to have this particular program compile on it just fine before. It does not work on my recently installed version of Eclipse, although I have the same environment as I did at school. (Or at least I think I do.)
- 11-02-2009, 01:49 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Did you import all the packages to your project?
- 11-02-2009, 01:52 AM #3
Member
- Join Date
- Oct 2009
- Posts
- 6
- Rep Power
- 0
I'm not sure what you mean by import packages; is that different from the two lines of code that I posted in my message? If it is, how do I do this?
- 11-02-2009, 01:58 AM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Okay, I'll explain it in this way.
First of all you've to attach the package (a jar file basically) in to your application first. That means you've to place your package in the correct place to access within your code. You can add it into your classpath. Or else you can do this through the IDE as well, in that case IDE do all the things for you, attaching into the correct place.
Import statement is another thing, that's the way how you access the package.
Is that clear to you?
- 11-02-2009, 04:00 AM #5
Member
- Join Date
- Oct 2009
- Posts
- 6
- Rep Power
- 0
Ok, I think I understand what you're saying. I'm not sure how to put this into practice though.
- 11-02-2009, 06:14 AM #6
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
You are using Eclipse, and there is an option to link external jar file into your project. Did you search on that?
- 11-02-2009, 07:16 PM #7
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
Right click your project, Build path->Configure build path->Libraries->Add Library and select JUnit.
- 11-03-2009, 03:20 AM #8
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Sorry, I didn't post the way to do that. Because I'm not using Eclipse.
Similar Threads
-
Vista + eclipse + JUnit => "No socket available"
By elannik in forum EclipseReplies: 5Last Post: 04-02-2010, 04:01 PM -
Eclipse "import not resolved" package problem?
By spamsickle in forum New To JavaReplies: 3Last Post: 08-24-2009, 11:44 AM -
MoneyOut.println("It took you (whats wrong?>",year,"<WW?) years to repay the loan")
By soc86 in forum New To JavaReplies: 2Last Post: 01-24-2009, 06:56 PM -
the dollar sign "$", prints like any other normal char in java like "a" or "*" ?
By lse123 in forum New To JavaReplies: 1Last Post: 10-20-2008, 07:35 AM -
Dependencies "cannot be resolved"
By Jesdisciple in forum EclipseReplies: 0Last Post: 05-03-2008, 06:54 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks