Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » [SOLVED] use class from another package("... cannot be resolved to a type")
[SOLVED] use class from another package [message #656716] Mon, 28 February 2011 09:05 Go to next message
Lyubomir is currently offline LyubomirFriend
Messages: 2
Registered: February 2011
Junior Member
I have 2 projects, one in package "myserver" the other in package "myclient". In myclient I am supposed to use an interface "Calculator" from myserver. I have copied the "Calculator.class" to bin/myserver/ inside the myclient project.

When I do "private myserver.Calculator calc;" I get "myserver cannot be resolved to a type". Even adding "import myserver.*;" results in cannot be resolved. Refreshing and restarting Ecliple doesn't help.

myserver and the Calculator.class can be seen in myclient project under Navigator. I can't import class folder in JavaBuildPath as it is in the default bin for myclient. External Class Folder doesn't work as well.

Is there a way to get it work, I can't use the source code for Calculator.class.

------------
Eclipse SDK Version: 3.6.1 Build id: M20100909-0800
Using JavaSE-1.6
Windows 7 x64

Trying to do a RMI server-client calculator and the myclient needs to have the Calculator.class.
------------

Cheers.

[Updated on: Mon, 28 February 2011 19:58]

Report message to a moderator

Re: use class from another package [message #656732 is a reply to message #656716] Mon, 28 February 2011 10:35 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
On 28.02.2011 10:05, Lyubomir wrote:
> I have 2 projects, one in package "myserver" the other in package
> "myclient". In myclient I am supposed to use an interface "Calculator"
> from myserver. I have copied the "Calculator.class" to bin/myserver/
> inside the myclient project.
>
> When I do "private myserver.Calculator calc;" I get "myserver cannot
> be resolved to a type". Even adding "import myserver.*;" results in
> cannot be resolved. Refreshing and restarting Ecliple doesn't help.
>
> myserver and the Calculator.class can be seen in myclient project
> under Navigator. I can't import class folder in JavaBuildPath as it is
> in the default bin for myclient. External Class Folder doesn't work as
> well.
>
> Is there a way to get it work, I can't use the source code for
> Calculator.class.
The External Class Folder should do the trick. What's not working there?

Dani
>
> ------------
> Eclipse SDK Version: 3.6.1 Build id: M20100909-0800
> Using JavaSE-1.6
> Windows 7 x64
>
> Trying to do a RMI server-client calculator and the myclient needs to
> have the Calculator.class.
> ------------
>
> Cheers.
Re: use class from another package [message #656867 is a reply to message #656732] Mon, 28 February 2011 19:57 Go to previous messageGo to next message
Lyubomir is currently offline LyubomirFriend
Messages: 2
Registered: February 2011
Junior Member
It didn't work when I tried to use myserver bin folder. So I moved Calculator.class in a new folder and added External Class Folder and it worked!

Why doesn't it work by default if I leave it in the myclient bin folder? Does it always need the .java source?

Cheers.
Re: use class from another package [message #656956 is a reply to message #656867] Tue, 01 March 2011 07:29 Go to previous message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
On 28.02.2011 20:57, Lyubomir wrote:
> It didn't work when I tried to use myserver bin folder. So I moved
> Calculator.class in a new folder and added External Class Folder and
> it worked!
>
> Why doesn't it work by default if I leave it in the myclient bin
> folder? Does it always need the .java source?
No, it does not always need the Java source files JDT Core checks the
project's Java build path which can have source, JARs and class folders.
The 'bin' (or better: 'Output') folders are considered owned by JDT Core
and are used to store the class files that get generated from those Java
source files which are on the Java build path.

Dani
>
> Cheers.
Previous Topic:need to integrate market place client in eclipse 3.2
Next Topic:Adding a project into an existing workspace via the command line shell
Goto Forum:
  


Current Time: Thu Apr 25 01:44:54 GMT 2024

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

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

Back to the top