If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
rcmaniac25
Posts: 1,804
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.2174, Z10 (STL100-3)-10.3.0.700 Dev OS, Z30 (STA100-5)-10.3.0.700 Dev OS, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Eclipse error or BB Plug-In error?

I have a bunch of projects in Eclipse, they are all stored in one folder:

WORKSPACE_FOLDER:
         PROJ1_FOLDER
                  src
                  res
                  ...
         PROJ2_FOLDER
                  src
                  res
                  ...
         PROJ3_FOLDER
                  src
                  res
                  ...
         ...

Everything compiled fine like this.

 

Recently I moved a couple classes to their own dedicated folder because they were similar:

 

WORKSPACE_FOLDER:
         GROUP_FOLDER
                  PROJ1_FOLDER
                           src
                           res
                           ...
                  PROJ2_FOLDER
                           src
                           res
                           ...
         PROJ3_FOLDER
                  src
                  res
                  ...
         ...

Now Proj3 compiles fine but Proj1 and Proj2 get exceptions and won't compile. If I do a search in Eclipse it gets an exception and when I compile I get an exception (different exceptions).

 

The exception I get is:

java.lang.NullPointerException
	at net.rim.ejde.A.D.E.A(RIMEIDE:1956)
	at net.rim.ejde.A.D.E.A(RIMEIDE:3520)
	at net.rim.ejde.A.D.A.run(RIMEIDE:3521)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1800)
	at net.rim.ejde.A.D.C.runInWorkspace(RIMEIDE:3462)
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

 

The preprocessor won't work either and I tried restarting Eclipse, removing then re-adding the projects, etc.

 

I am using:

  • Eclipse 3.5.2.M20100211-1343
  • BlackBerry Java Plug-in 1.1.2.201004161203-16
  • BlackBerry Java SDK 5.0.0.25

So has anyone encountered this before? Is this an Eclipse problem or BB Plug-In error? Anyone have a fix for it if they encountered this before?

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.
New Developer
I_Mudd
Posts: 7
Registered: ‎12-14-2009
My Device: Storm 9530
My Carrier: Verizon

Re: Eclipse error or BB Plug-In error?

Don't panic -- this is easy to fix.  When you moved projects 1 and 2 into the GROUP_DIRECTORY, the full path names to your files no longer match the declared package names in each of your source files.

 

My first thought was to tell you to go through all your source files and update the package names to match the files' new path names.  Instead, we will let the computer do the work.

 

I'm using Eclipse 3.5.0, so YMMV.  In the left panel, right-click on the package name (example com.companyname.blah.projectname) for package 1 which is probably just under the src directory in the tree.  In the context menu, select Refactor->Rename...

 

In the dialog that appears, update the package name to include the GROUP_DIRECTORY.  Click Ok.  I got a warning because my application has a main() method, just like every other Blackberry application.  Take heed, then click Continue.

 

Isn't Eclipse great?  Not only did it update the package name in _ALL_ your source files, but it created the GROUP_DIRECTORY and moved your files inside it automatically.  Now please do the same thing for Project 2.  Now, in the Project menu, select Blackberry->Clean Simulator...  Click Select All and click Ok.  Wait for this to complete.  Clean your project and build it again.  This time it builds and runs without those annoying errors, right?  Well, it actually builds and runs with the same number of errors and warnings that existed before you decided to do some interior decorating.

 

Eclipse tip:  Eclipse is a full service IDE that takes responsibility for managing the files in your project.  If you want to do anything with your project or its files, it's best to ask Eclipse and let it make the changes you want.

 

I know, I know.  How "Apple" of me.  =)

 

Success!!

I_Mudd

 

P.S.  Blue is the new red.

Please use plain text.
New Developer
I_Mudd
Posts: 7
Registered: ‎12-14-2009
My Device: Storm 9530
My Carrier: Verizon

Re: Eclipse error or BB Plug-In error?

Well, I'm very embarrassed now.  After I posted that last response to your question, I realized that it doesn't quite solve your problem.  My last set of instructions creates two GROUP_FOLDERs, one inside each of the two projects you're trying to move.  I'm sorry.

 

I have a correct solution for you, but I don't think you're going to like it.  Once you do this, the projects will exist inside the GROUP_FOLDER in your file system, but Eclipse won't change its display all your projects in the left panel.  Therefore, I don't think it's worth doing.

 

Anyway, in Eclipse's left panel, right-click on Project 1.  In the context menu that appears, select Refactor->Move...

 

In the dialog box that appears, insert the name of your GROUP_FOLDER in the project's full path name between your Blackberry Workspace directory and Project 1.  Some red error text will appear while you're typing.  Just ignore it; it will go away when you're finished.  Don't forget to use backslashes where needed.  Click Ok.

 

Eclipse will create the GROUP_FOLDER and move your project inside it.  If you perform the same procedure for Project 2, they will both reside inside the GROUP_FOLDER.  Eclipse's display of your projects will not change.

 

If your Blackberry workspace is getting too full of projects, my advice is to create more Blackberry workspaces and separate your projects as much as possible.  I realize that there are probably some dependency issues amongst your projects, but odds are you'll be able to reduce the clutter a little.

 

Best of luck to you,

I_Mudd

 

P.S.  It's better to seek forgiveness than to seek permission.

ERROR:  Wise proverb does not apply to current situation.  Forgiveness denied.

Please use plain text.
Developer
rcmaniac25
Posts: 1,804
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.2174, Z10 (STL100-3)-10.3.0.700 Dev OS, Z30 (STA100-5)-10.3.0.700 Dev OS, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: Eclipse error or BB Plug-In error?

Thanks for trying but to no avail. Refactor->Move does not work, my project basically gets deleted before Eclipse tries to move it, thus I end up with no project.

 

Luckily I had encountered this before (lost that whole project :smileysad:) so I had a backup of the projects. Re-adding source code didn't work either.

 

I tried creating an entire new project in the folder, I got a error message saying that "Projects must be located in the workspace folder" and couldn't be in a subfolder. So that killed that experiment.

 

I did some testing and decompiliation and found the problem comes from trying to get the output folder for... something. I can't get it to working right now, I'm going to try remaking the project in the workspace folder.

 

For now my work around is copying the projects to the single folder (it's for source control). I'll need to play around with automating it for now but it seems like an Eclipse problem right now.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.
New Developer
I_Mudd
Posts: 7
Registered: ‎12-14-2009
My Device: Storm 9530
My Carrier: Verizon

Re: Eclipse error or BB Plug-In error?

That's very disappointing.  I was using Eclipse version 3.5.0.  I executed these instructions while I typed both of my earlier responses to make sure the instructions were right.  I moved two test projects into a common subdirectory just as I described, and then I successfully moved them back to the Blackberry Workspace directory.  Sorry things didn't work out for you.

 

One thing that might make the difference comes to mind.  My GROUP_DIRECTORY was located inside my Blackberry Workspace directory.  Are you trying to locate a project outside of the BB Workspace, somewhere else on your file system?  Eclipse might not like that.

 

If you're doing this for backup purposes, why not backup the entire Blackberry Workspace directory and

copy all your projects?

 

I_Mudd

 

P.S.  I've spun my top totem, and I'm waiting for it to fall.  I INSIST that this is reality!

P.P.S.  I'm still waiting...

Please use plain text.
Developer
rcmaniac25
Posts: 1,804
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.2.1.2174, Z10 (STL100-3)-10.3.0.700 Dev OS, Z30 (STA100-5)-10.3.0.700 Dev OS, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: Eclipse error or BB Plug-In error?

Yea it is a little disappointing. My "GROUP_DIRECTORY" is located in the Workspace directory as well. But when I import the project from that directory it doesn't compile. When I try to create the project in that directory, Eclipse says that it isn't a valid location.

 

It isn't a backup process, the project I am talking about is open source so I push the projects in the open source project to the website.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Please use plain text.