I had a real pain of a problem today. I was importing projects into Eclipse, finished resolving all the unbound libraries etc., but then had this error come up:
The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class file
Now this isn't very useful, and I couldn't for the life of me figure it out. But luckily it's a common problem easily fixed. I must pass credit to Ram S. Khanal for posting this solution on the Sun developer forums:
In Eclipse, the cause of this problem is that you somehow deleted the SYSTEM JRE LIBRARY associated with your project.
Simple fix in Eclipse:
-Right Click Project you are working on from Package Explorer
-Go to Properties
-Go to Java Build Path from the right tree structure
-Go to Libraries Tab
-Choose Add Library Button
-Select JRE System Library
-Hit Next, the Radio button will prompt the Workspace default JRE, and let it be that way
-Hit Finish
In my case I was importing a J2ME project built in EclipseME. I forget that you have to import the Wireless Toolkit settings everytime you create new projects in new workspaces. So here's what I did:
1) Go to Project -> Properties
2) Click on 'Manage Devices'
3) At this point, the device list is probably empty. Click on Import
4) Select the root of your Wireless Toolkit, and press Refresh
5) Select all devices and press Finish, Apply, and OK
At this point EclipseME should now be configured to use whatever device emulator you had selected as default.
Comments
Rest assured that you aren't the only person who have tried it!! I did it some months ago, but realised it myself when I looked at the path settings ;-)
BTW I noticed that you use eclipse with j2ME. I've tried to install it (using easyeclipse for j2ME) and I simply can't get it to import any devices. I've tried with the default one's contained in j2ME toolkit, and it simply doesn't work. Did it work easily for you, or did you have to perform some magic?
At the mo I'm stuck using the sun wireless toolkit - not exactly the best option...
Karsten Oster Lundqvist on Friday, 27 April 2007, 17:00 BST # |
David Johnson on Saturday, 28 April 2007, 15:06 BST # |
Yea, see that is my problem... All that easyeclipse ships with (in reality) is eclipseME, but that doesn't support Sun's Wireless toolkit 2.5, it only supports up to 2.3 - Unfortunately Sun only provides 2.5 downloads, so it seems like I'm stuck. Most of the other devices seems to be unsupported as well.
You don't have the 2.3 files on your hd by any chance? (sun_java_wireless_toolkit-2_3-beta-windows.exe according to http://java.sun.com/products/sjwtoolkit/download-2_3.html)
Otherwise it seems like I'll make do with the old text editor approach, which works too (but I like eclipse more...)
Karsten Oster Lundqvist on Monday, 30 April 2007, 09:30 BST # |
I'm definitely using WTK 2.5 with EclipseME, installed on 3 different machines so it definitely works. I know on there pages it says only supports up to WTK 2.3, but I've been using 2.5 (but the beta one, don't know if it makes any huge difference) for ages with zilch problems.
Does the EasyEclipse Mobile distro support the latest version of EclipseME? - the docs say the bundled version isn't the latest one, so that might make a difference.
David Johnson on Monday, 30 April 2007, 10:29 BST # |
Hmn - good questions. I've now got a working distro, with easyeclipse (normal java desktop distro), the eclipseME plugin hardwired in and the Wireless toolkit 2.2 (found it in Sun's old file repository).
I'll do a bit of digging into this, because it is truely odd!!!
Karsten Oster Lundqvist on Monday, 30 April 2007, 11:15 BST # |
Karsten Oster Lundqvist on Monday, 30 April 2007, 11:20 BST # |
Good to hear it sorted itself out...
Just curious, but what are you using J2ME for? Or are you just experimenting?
David Johnson on Tuesday, 01 May 2007, 08:21 BST # |
I'm sort of experimenting, because within the MeAggregator project we will need access to and use mobile phones, so I thought I'd just get that part up and running...
Also more leisurely (sometimes it is difficult in my work to figure out what is leisure and work, nice isn't it?!!) I'd like to code a bit on mobile phones, because it makes sense to use mobiles in many different applications.
A speaker said in a conference I went to last year something like this: "Look in your organisation and find the person who develops for mobiles, and you'll see the person that has the job you want in 3 years time!" Not that I'm looking for another job, but it is good to at least follow different trends, and maybe even combine them with what you already do...
Karsten Oster Lundqvist on Tuesday, 01 May 2007, 10:33 BST # |
Gosh, I hope that's true... I could do with another job...
Well if you need any pointers with J2ME stuff, just drop me a line. Or even better, post a question in the Java community! (someone has to use it!!)
David Johnson on Tuesday, 01 May 2007, 11:51 BST # |