Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Restrict imports in auto-import prompter
Restrict imports in auto-import prompter [message #181529] Fri, 24 November 2006 10:16 Go to next message
Shug Boabby is currently offline Shug BoabbyFriend
Messages: 8
Registered: July 2009
Junior Member
Hi everyone,

I've recently started doing some J2ME coding using EclipseME to do all the
setup, but the auto complete is unfortunately pulling in J2SE classes and
so forth... I'd really like to impose a restriction to only use lang and
J2ME classes. (For those who don't know... J2ME is a very small subset of
the Collections).

I guess this comes from the fact that the J2ME library (defined by the
project) includes the J2SE jars, as well as my OS extensions. There
doesn't appear to be any way to remove individual jar files from a System
Library.

I have the cldc/midp (i.e. the J2ME collections for most cell phones) jar
files, so perhaps if there is a way to tell the auto-import tool to only
search those jars (on a by-project basis)?

Could somebody please help with restricting my auto-importer in this way?

Thanks,
Shug
Re: Restrict imports in auto-import prompter [message #181708 is a reply to message #181529] Fri, 24 November 2006 16:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: wegener.cboenospam.com

Shug wrote:
> Hi everyone,
>
> I've recently started doing some J2ME coding using EclipseME to do all
> the setup, but the auto complete is unfortunately pulling in J2SE
> classes and so forth... I'd really like to impose a restriction to only
> use lang and J2ME classes. (For those who don't know... J2ME is a very
> small subset of the Collections).
>
> I guess this comes from the fact that the J2ME library (defined by the
> project) includes the J2SE jars, as well as my OS extensions. There
> doesn't appear to be any way to remove individual jar files from a
> System Library.
>

You indicate that the project has a J2ME library defined. However, you
also refer to the System Library. Do you have both the J2ME library and
the System library defined on the build path (Properties->Java Build
Path->Libraries). If so, remove the System Library from your build path
and only leave the J2ME library.

If the J2ME library contains the J2SE jars, edit the library and remove
the J2SE jars leaving only the J2ME jar files that you need.


> I have the cldc/midp (i.e. the J2ME collections for most cell phones)
> jar files, so perhaps if there is a way to tell the auto-import tool to
> only search those jars (on a by-project basis)?
>
> Could somebody please help with restricting my auto-importer in this way?
>
> Thanks,
> Shug
>
Re: Restrict imports in auto-import prompter [message #181713 is a reply to message #181708] Fri, 24 November 2006 16:11 Go to previous messageGo to next message
Shug Boabby is currently offline Shug BoabbyFriend
Messages: 8
Registered: July 2009
Junior Member
David Wegener wrote:
> If the J2ME library contains the J2SE jars, edit the library and remove
> the J2SE jars leaving only the J2ME jar files that you need.

I'm afraid that isn't possible... the EclipseME plugin adds the J2SE libs
automatically as part of the J2ME library and cannot be removed without
removing all the build libraries.

Manually overriding this behaviour and adding the J2ME libs means that
lang.Object is missing and results in a bunch of errors... adding the
System classes.jar file then results in a binary that doesn't run.

Bit of a catch 22 really... so the only ways I see around this are if
EclipseME fix it, or if there is a way to add an exclude list to the auto
importer on a per-project basis.
Re: Restrict imports in auto-import prompter [message #181724 is a reply to message #181713] Fri, 24 November 2006 21:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse4.rizzoweb.com

Shug wrote:
> David Wegener wrote:
>> If the J2ME library contains the J2SE jars, edit the library and
>> remove the J2SE jars leaving only the J2ME jar files that you need.
>
> I'm afraid that isn't possible... the EclipseME plugin adds the J2SE
> libs automatically as part of the J2ME library and cannot be removed
> without removing all the build libraries.

You can edit the JRE configurations, including add/removing JARs from
them. I recommend, in your project Build Path, remove the "Standard"
J2ME system library and add a new User Library; it will allow you to
create a new User Library whicih you can build up from whatever JARs you
want.
Alternatively, you can edit the J2ME System Library (or copy it) and
remove the unwanted JARs.

Hope this helps,
Eric
Re: Restrict imports in auto-import prompter [message #181732 is a reply to message #181724] Sat, 25 November 2006 12:01 Go to previous messageGo to next message
Shug Boabby is currently offline Shug BoabbyFriend
Messages: 8
Registered: July 2009
Junior Member
Hey, what do you know... that worked!

I was trying to do that before, but I was using the Java-1.3 libraries
because the style/binary compatibility is 1.3/1.1 respectively. But it
seems all I needed was to use the Java5 classes.jar file.

I'll report this as a bug to the EclipseME people
Re: Restrict imports in auto-import prompter [message #181744 is a reply to message #181732] Sun, 26 November 2006 01:25 Go to previous messageGo to next message
Shug Boabby is currently offline Shug BoabbyFriend
Messages: 8
Registered: July 2009
Junior Member
Aaargh, this still hasn't fixed the problem, because including classes.jar
contains all of J2SE

Is there really no way to restrict the valid classes to import?
Re: Restrict imports in auto-import prompter [message #181822 is a reply to message #181744] Mon, 27 November 2006 18:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse4.rizzoweb.com

Shug wrote:
> Aaargh, this still hasn't fixed the problem, because including
> classes.jar contains all of J2SE
>
> Is there really no way to restrict the valid classes to import?
>

Yes there is, by restricting what is on the build path ;-). If the Java
Runtime libraries you are using include classes, then those classes are
available to be used.
Sounds to me like you've either got the wrong runtime library or the
classes should be usable on your desired J2ME platform. In any case, I
suggest posting on whatever EclipseME formus there are, because JME is a
specialty area that most of us are probably nor familiar with.

Hope this helps,
Eric
Re: Restrict imports in auto-import prompter [message #181926 is a reply to message #181822] Tue, 28 November 2006 08:22 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
Eric Rizzo wrote:

> Shug wrote:
>
>> Aaargh, this still hasn't fixed the problem, because including
>> classes.jar contains all of J2SE
>>
>> Is there really no way to restrict the valid classes to import?
>
You could add access rules to forbid certain packages and types.

Dani

>>
>
> Yes there is, by restricting what is on the build path ;-). If the
> Java Runtime libraries you are using include classes, then those
> classes are available to be used.
> Sounds to me like you've either got the wrong runtime library or the
> classes should be usable on your desired J2ME platform. In any case, I
> suggest posting on whatever EclipseME formus there are, because JME is
> a specialty area that most of us are probably nor familiar with.
>
> Hope this helps,
> Eric
Re: Restrict imports in auto-import prompter [message #181963 is a reply to message #181926] Tue, 28 November 2006 11:00 Go to previous messageGo to next message
Shug Boabby is currently offline Shug BoabbyFriend
Messages: 8
Registered: July 2009
Junior Member
Access rules!!! Thanks for that Daniel :-)

Eric: it is not possible to simply remove individual jar files from the
build path, which is why I posted this question in the first place.
Re: Restrict imports in auto-import prompter [message #182021 is a reply to message #181963] Tue, 28 November 2006 18:47 Go to previous message
Eclipse UserFriend
Originally posted by: eclipse4.rizzoweb.com

Shug wrote:
> Access rules!!! Thanks for that Daniel :-)
>
> Eric: it is not possible to simply remove individual jar files from the
> build path, which is why I posted this question in the first place.
>

I didn't know you could apply access rules at that level - cool.

It is possible to remove individual JARs from a build path, even if they
are part of a Library. You can either edit the Library or create a new
one that does not include the JARs you don't want. I think I explained
how to do that a couple of messages back in the thread.

Eric
Previous Topic:GEF Diagrams in a Multipage Editor
Next Topic:-Xss option always gives "invalid thread stack size"
Goto Forum:
  


Current Time: Sat Apr 27 05:14:32 GMT 2024

Powered by FUDForum. Page generated in 0.09491 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top