-
May 22nd, 2011, 12:07 PM
#1
"The import org.springframework cannot be resolved"
In the tradition of Homer and Virgil, I begin the story
in medias res. I have just succeeded in getting the
SpringSource Tool Suite to start up without crashing.
This is after more than one month of trying. What
finally worked was adding the following two lines to
STS.ini:
-Dorg.eclipse.swt.browser.UseWebKitGTK=true
-Dorg.eclipse.swt.browser.XULRunnerPath=/usr/lib/xulrunner2.0
This is, apparently, an initiation rite. Only the
programmers who can figure out the two secret lines
that must be added to STS.ini are worthy of being
allowed to use the SpringSource Tool Suite. But enough
of the backstory; we are to begin, as indicated above,
in medias res.
Within the STS, I created a new Spring project, and
then I created 4 files. A "Hello World" interface
defines the arguments (none) and the return value
(none) of a "Hello World" service. A "Hello World"
implementation class implements the service by
performing System.out.println on a private field. This
field is given its value ("Hello World") in hello.xml.
Finally, a "Hello World" driver class, he that is
furnished with the public static void main,
instantiates an XmlBeanFactory from a ClassPathResource
instantiated from "hello.xml", invokes the getBean
method on said bean factory to retrieve a bean, and
invokes the "Hello World" method on said bean.
If there can be a simpler Spring project than this, I
am at pains to imagine it.
Of the 3 Java class files, only the "Hello World"
driver class refers to any Spring libraries. This is
the file that the STS rejects, flagging the very first
line with the error "The import org.springframework
cannot be resolved".
The conventional wisdom, gleaned from sifting thru the
numerous postings in this forum, recites that I must
"right-click on [my] project, then 'Properties -> Java
Build Path -> Libraries' and check whether [I] have the
spring library JARs in the place that is mentioned
there. If not, just re-add them to your classpath
within this dialog." There may be an alternate
universe in which this conventional wisdom is useful.
In the universe that I inhabit, when I right-click on
my project, and then select "Properties" from the
pop-up menu that appears, the window that pops up does
not offer any user interface component labeled with
"Java Build Path", or anything equivalent to it, or
remotely resembling it. Rather than describing the
window that does pop up, I have placed a screenshot of
it on my webserver, and the gentle reader may see it at
http://m5.chicago.il.us/images/ProjectProperties.gif.
You will note that there is nothing in that window that
offers to add JARs to my project. Nor is there
anything in the menu that pops down from the "Project"
menubutton in the STS menubar that can lead to the
promised bliss. There is a "Properties" menuitem in
the pop-down menu, but it is insensitive to user
input.
I understand that you may not wish to answer me on this
public forum, because these are hidden mysteries, not
to be revealed to those who have not proven their
devotion to Spring. But I have proven myself. I have
spent nearly two months trying to get this bloody thing
to work. If you wish to respond privately, please send
e-mail to jay@m5.chicago.il.us, or telephone me at
(1-773)7613784. Thank you in advance for your replies.
-
May 22nd, 2011, 02:03 PM
#2
If you struggled so long why not seek help earlier... In general installing STS is download, unzip and run... If that isn't working you must be having something else in your environment that isn't supported. Judging from your screenshot you are using some linux or bsd based OS.
Although I don't really like the tone of your mail I'm still going to respond. I suggest removing the project (or simply start a new one), create a java project and afterwards add the spring nature. For some reason the project you created isn't a java project (either that or your STS/eclipse is screwed).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules