This page is no longer maintained — Please continue to the home page at www.scala-lang.org

How to access static methods of Java code?

22 replies
nick.rudnick@go...
Joined: 2011-03-27,
User offline. Last seen 42 years 45 weeks ago.

Dear all,

is it possible to access (public) static methods of classes in Java
code? How?

Thanks a lot in advance, Nick

Philippe Lhoste
Joined: 2010-09-02,
User offline. Last seen 42 years 45 weeks ago.
Re: How to access static methods of Java code?

On 27/03/2011 15:49, nick.rudnick wrote:
> is it possible to access (public) static methods of classes in Java
> code? How?

Something like:
println(System.nanoTime)
?

nick.rudnick@go...
Joined: 2011-03-27,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: How to access static methods of Java code?
Hi Philippe,
exactly: public synchronized static double getTime() of some Java class. 
Scala complains there is no such method -- might there be problem with «synchronized»?
Thanks for the quick answer, Nick
2011/3/27 Philippe Lhoste <PhiLho@gmx.net>
On 27/03/2011 15:49, nick.rudnick wrote:
is it possible to access (public) static methods of classes in Java
code? How?

Something like:
println(System.nanoTime)
?

H-star Development
Joined: 2010-04-14,
User offline. Last seen 2 years 26 weeks ago.
Re: How to access static methods of Java code?

Am 27.03.2011 15:49, schrieb nick.rudnick@googlemail.com:
> Dear all,
>
> is it possible to access (public) static methods of classes in Java
> code? How?
>
> Thanks a lot in advance, Nick
>
you are asking how to access a static method from java in java?

H-star Development
Joined: 2010-04-14,
User offline. Last seen 2 years 26 weeks ago.
Re: Re: How to access static methods of Java code?
that should work. what exactly is the code?

Am 27.03.2011 16:02, schrieb Nick Rudnick:
fcJ10vftqoN [at] mail [dot] gmail [dot] com" type="cite">Hi Philippe,
exactly: public synchronized static double getTime() of some Java class. 
Scala complains there is no such method -- might there be problem with «synchronized»?
Thanks for the quick answer, Nick
2011/3/27 Philippe Lhoste <PhiLho [at] gmx [dot] net" rel="nofollow">PhiLho@gmx.net>
On 27/03/2011 15:49, nick.rudnick wrote:
is it possible to access (public) static methods of classes in Java
code? How?

Something like:
println(System.nanoTime)
?

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --



Philippe Lhoste
Joined: 2010-09-02,
User offline. Last seen 42 years 45 weeks ago.
Re: How to access static methods of Java code?

On 27/03/2011 16:02, Nick Rudnick wrote:
> exactly: *public synchronized static double getTime()* of some Java class.
>
> Scala complains there is no such method -- might there be problem with
> «synchronized»?

Or there might be a problem in path to the method.
No information, no easy answer...
Is that in a public API or in some proprietary code?

nick.rudnick@go...
Joined: 2011-03-27,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: How to access static methods of Java code?
Hi HamsterOfDeath,
thanks for your interest:
= 8< ====================================== package de.renew.discEvSimimport de.renew.engine.searchqueue.SearchQueue object TS {  def einmalJeSekunde(): Double = {      SearchQueue.getTime()  }} = 8< ======================================package de.renew.engine.searchqueue;... public class SearchQueue {...public synchronized static double getTime() {         assert SimulationThreadPool.isSimulationThread() : "is not in a simulation thread";        return time;     }...} = 8< ======================================

2011/3/27 HamsterofDeath <h-star@gmx.de>
that should work. what exactly is the code?

Am 27.03.2011 16:02, schrieb Nick Rudnick:
Hi Philippe,
exactly: public synchronized static double getTime() of some Java class. 
Scala complains there is no such method -- might there be problem with «synchronized»?
Thanks for the quick answer, Nick
2011/3/27 Philippe Lhoste <PhiLho@gmx.net>
On 27/03/2011 15:49, nick.rudnick wrote:
is it possible to access (public) static methods of classes in Java
code? How?

Something like:
println(System.nanoTime)
?

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --




nick.rudnick@go...
Joined: 2011-03-27,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: How to access static methods of Java code?
Hi Philippe,
the code is of an open source tool (www.renew.de), present in as source code directory. Working with Eclipse, I put this code to a (different) Java project and made the Scala project dependend on it -- Java classes of the Scala project referring to the Java project don't show complaints.
All the best, Nick 

2011/3/27 Philippe Lhoste <PhiLho@gmx.net>
On 27/03/2011 16:02, Nick Rudnick wrote:
exactly: *public synchronized static double getTime()* of some Java class.

Scala complains there is no such method -- might there be problem with
«synchronized»?

Or there might be a problem in path to the method.
No information, no easy answer...
Is that in a public API or in some proprietary code?

H-star Development
Joined: 2010-04-14,
User offline. Last seen 2 years 26 weeks ago.
Re: Re: How to access static methods of Java code?
that *should* work. i don't know how exactly how you have to compile what in which order to make this work, but i can compile code like this without problems using intellij idea, no matter if i put everything in a single project or make 2 where one depends on the other. you might give it a try, there's a free community edition which has a free scala plugin. (yes, i am pro intellij and biased)

Am 27.03.2011 16:28, schrieb Nick Rudnick:
AANLkTimkpiGaAfii0TBerZBBevO2AArptcS8Bp+9wvUk [at] mail [dot] gmail [dot] com" type="cite"> Hi HamsterOfDeath,
thanks for your interest:
= 8< ====================================== package de.renew.discEvSim import de.renew.engine.searchqueue.SearchQueue object TS {   def einmalJeSekunde(): Double = {      SearchQueue.getTime()   } } = 8< ====================================== package de.renew.engine.searchqueue; ... public class SearchQueue { ... public synchronized static double getTime() {         assert SimulationThreadPool.isSimulationThread() : "is not in a simulation thread";         return time;     } ... } = 8< ======================================

2011/3/27 HamsterofDeath <h-star [at] gmx [dot] de" rel="nofollow">h-star@gmx.de>
that should work. what exactly is the code?

Am 27.03.2011 16:02, schrieb Nick Rudnick:
Hi Philippe,
exactly: public synchronized static double getTime() of some Java class. 
Scala complains there is no such method -- might there be problem with «synchronized»?
Thanks for the quick answer, Nick
2011/3/27 Philippe Lhoste <PhiLho [at] gmx [dot] net" target="_blank" rel="nofollow">PhiLho@gmx.net>
On 27/03/2011 15:49, nick.rudnick wrote:
is it possible to access (public) static methods of classes in Java
code? How?

Something like:
println(System.nanoTime)
?

--
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  --  --  --  --  --  --  --  --  --  --  --  --  --





nick.rudnick@go...
Joined: 2011-03-27,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: How to access static methods of Java code?
Dear all,
if you say it is an imports/paths issue, this is a hint -- I must admit I would wish to have any good documentation on this subject, but did not find any... maybe anybody has a link to follow...??
Cheers, Nick


2011/3/27 Nick Rudnick <nick.rudnick@googlemail.com>
Hi Philippe,
the code is of an open source tool (www.renew.de), present in as source code directory. Working with Eclipse, I put this code to a (different) Java project and made the Scala project dependend on it -- Java classes of the Scala project referring to the Java project don't show complaints.
All the best, Nick 

2011/3/27 Philippe Lhoste <PhiLho@gmx.net>
On 27/03/2011 16:02, Nick Rudnick wrote:
exactly: *public synchronized static double getTime()* of some Java class.

Scala complains there is no such method -- might there be problem with
«synchronized»?

Or there might be a problem in path to the method.
No information, no easy answer...
Is that in a public API or in some proprietary code?

Philippe Lhoste
Joined: 2010-09-02,
User offline. Last seen 42 years 45 weeks ago.
Re: How to access static methods of Java code?

On 27/03/2011 16:28, Nick Rudnick wrote:
> Hi HamsterOfDeath,
>
> thanks for your interest:
>
> = 8< ======================================
> package de.renew.discEvSim
> import de.renew.engine.searchqueue.SearchQueue
> object TS {
> def einmalJeSekunde(): Double = {
> SearchQueue.getTime()
> }
> }
> = 8< ======================================
> package de.renew.engine.searchqueue;
> ...
> public class SearchQueue {
> ...
> public synchronized static double getTime() {
> assert SimulationThreadPool.isSimulationThread() : "is not in a
> simulation thread";
> return time;
> }
> ...
> }
> = 8< ======================================

OK, I found the site based on this info (giving the URL upfront would
have been better... :-))

Played a bit with the code:

> scala
Welcome to Scala version 2.8.1.final (Java HotSpot(TM) Client VM, Java
1.6.0_21).
Type in expressions to have them evaluated.
Type :help for more information.

scala> :cp G:\Tmp\renew\simulator-2.2_1.2.jar
Added 'G:\Tmp\renew\simulator-2.2_1.2.jar'. Your new classpath is:
.;C:\Program Files
(x86)\Java\jre6\lib\ext\QTJava.zip;G:\Tmp\renew\simulator-2.2_1.2.jar

scala> import de.renew.engine.searchqueue.SearchQueue
import de.renew.engine.searchqueue.SearchQueue

scala> println(SearchQueue.getTime)
error: error while loading SearchQueue, Missing dependency 'class
org.apache.log4j.Logger', required by
G:\Tmp\renew\simulator-2.2_1.2.jar(de/renew/engine/searchqueue/SearchQueue.class):7:
error: value getTime is not a member of object
de.renew.engine.searchqueue.SearchQueue println(SearchQueue.getTime)
^
scala> :cp G:\Tmp\renew\log4j-1.2.12.jar
Added 'G:\Tmp\renew\log4j-1.2.12.jar'. Your new classpath is:
.;C:\Program Files
(x86)\Java\jre6\lib\ext\QTJava.zip;G:\Tmp\renew\simulator-2.2_1.2.jar;G:\Tmp\renew\simulator-2.2_1.2.jar;G:\Tmp\renew\log4j-1.2.12.jar
Replaying: import de.renew.engine.searchqueue.SearchQueue
import de.renew.engine.searchqueue.SearchQueue

scala> println(SearchQueue.getTime)
0.0

So it is possible to access the function.

nick.rudnick@go...
Joined: 2011-03-27,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: How to access static methods of Java code?
Hi Philippe,
thank you very much, this led me into another direction -- I hadn't tried this approach on the command line and did not expect it to be working, as at the Eclipse IDE,
import de.renew.engine.searchqueue.SearchQueue

(with both paths in the Java build path) leads to the complaint
«value engine is not a member of package de.renew»,
for which I do not have solution, so that I moved the sources into a separate Java project, after some googling didn't do the trick. So I am trying to find out the meaning of this message now.
Thanks a lot, Nick

2011/3/27 Philippe Lhoste <PhiLho@gmx.net>
On 27/03/2011 16:28, Nick Rudnick wrote:
Hi HamsterOfDeath,

thanks for your interest:

= 8< ======================================
package de.renew.discEvSim
import de.renew.engine.searchqueue.SearchQueue
object TS {
  def einmalJeSekunde(): Double = {
     SearchQueue.getTime()
  }
}
= 8< ======================================
package de.renew.engine.searchqueue;
...
public class SearchQueue {
...
public synchronized static double getTime() {
        assert SimulationThreadPool.isSimulationThread() : "is not in a
simulation thread";
        return time;
    }
...
}
= 8< ======================================

OK, I found the site based on this info (giving the URL upfront would have been better... :-))

Played a bit with the code:

> scala
Welcome to Scala version 2.8.1.final (Java HotSpot(TM) Client VM, Java 1.6.0_21).
Type in expressions to have them evaluated.
Type :help for more information.

scala> :cp G:\Tmp\renew\simulator-2.2_1.2.jar
Added 'G:\Tmp\renew\simulator-2.2_1.2.jar'.  Your new classpath is: .;C:\Program Files (x86)\Java\jre6\lib\ext\QTJava.zip;G:\Tmp\renew\simulator-2.2_1.2.jar

scala> import de.renew.engine.searchqueue.SearchQueue
import de.renew.engine.searchqueue.SearchQueue

scala> println(SearchQueue.getTime)
error: error while loading SearchQueue, Missing dependency 'class org.apache.log4j.Logger', required by G:\Tmp\renew\simulator-2.2_1.2.jar(de/renew/engine/searchqueue/SearchQueue.class)<console>:7: error: value getTime is not a member of object de.renew.engine.searchqueue.SearchQueue       println(SearchQueue.getTime)
                          ^
scala> :cp G:\Tmp\renew\log4j-1.2.12.jar
Added 'G:\Tmp\renew\log4j-1.2.12.jar'.  Your new classpath is: .;C:\Program Files (x86)\Java\jre6\lib\ext\QTJava.zip;G:\Tmp\renew\simulator-2.2_1.2.jar;G:\Tmp\renew\simulator-2.2_1.2.jar;G:\Tmp\renew\log4j-1.2.12.jar
Replaying: import de.renew.engine.searchqueue.SearchQueue
import de.renew.engine.searchqueue.SearchQueue

scala> println(SearchQueue.getTime)
0.0

So it is possible to access the function.

Philippe Lhoste
Joined: 2010-09-02,
User offline. Last seen 42 years 45 weeks ago.
Re: How to access static methods of Java code?

On 27/03/2011 20:15, Nick Rudnick wrote:
> thank you very much, this led me into another direction -- I hadn't
> tried this approach on the command line and did not expect it to be
> working, as at the Eclipse IDE,
>
> import de.renew.engine.searchqueue.SearchQueue
>
> (with both paths in the Java build path) leads to the complaint
>
> «value engine is not a member of package de.renew»,
>
> for which I do not have solution, so that I moved the sources into a
> separate Java project, after some googling didn't do the trick. So I am
> trying to find out the meaning of this message now.

I am sorry if I state obvious things, but I don't know your level of
expertise with Eclipse... :-)
Have you put the jars (of Renew and of Log4j) in the libraries part of
your project?

nick.rudnick@go...
Joined: 2011-03-27,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: How to access static methods of Java code?
Hi Philippe,
you mean this??




2011/3/27 Philippe Lhoste <PhiLho@gmx.net>
On 27/03/2011 20:15, Nick Rudnick wrote:
thank you very much, this led me into another direction -- I hadn't
tried this approach on the command line and did not expect it to be
working, as at the Eclipse IDE,

import de.renew.engine.searchqueue.SearchQueue

(with both paths in the Java build path) leads to the complaint

«value engine is not a member of package de.renew»,

for which I do not have solution, so that I moved the sources into a
separate Java project, after some googling didn't do the trick. So I am
trying to find out the meaning of this message now.

I am sorry if I state obvious things, but I don't know your level of expertise with Eclipse... :-)
Have you put the jars (of Renew and of Log4j) in the libraries part of your project?

nick.rudnick@go...
Joined: 2011-03-27,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: How to access static methods of Java code?
Hi Philippe,
I have some years of experience with Eclipse, but working at university it is below that of a smart professional.
Hope you prefer the following to some config files in this case (I am not sure), as the code is minimal:


Thanks and all the best, Nick

2011/3/27 Philippe Lhoste <PhiLho@gmx.net>
On 27/03/2011 20:15, Nick Rudnick wrote:
thank you very much, this led me into another direction -- I hadn't
tried this approach on the command line and did not expect it to be
working, as at the Eclipse IDE,

import de.renew.engine.searchqueue.SearchQueue

(with both paths in the Java build path) leads to the complaint

«value engine is not a member of package de.renew»,

for which I do not have solution, so that I moved the sources into a
separate Java project, after some googling didn't do the trick. So I am
trying to find out the meaning of this message now.

I am sorry if I state obvious things, but I don't know your level of expertise with Eclipse... :-)
Have you put the jars (of Renew and of Log4j) in the libraries part of your project?

Philippe Lhoste
Joined: 2010-09-02,
User offline. Last seen 42 years 45 weeks ago.
Re: How to access static methods of Java code?

On 27/03/2011 23:56, Nick Rudnick wrote:
> Hope you prefer the following to some config files in this case (I am not sure), as the
> code is minimal:

Looks OK, I suppose.
Perhaps it is a bug in the Eclipse plug-in, which is currently far from perfect, from the
many reports I saw here and there.
So far I haven't tried any IDE plug-in for Scala, my Scala micro-projects are small enough
to be manageable via a simple editor and the command line (and Gradle when I need to bring
in some dependencies).

Note: currently in the IDE ecosystem of plug-ins for Scala, IntelliJ IDEA is getting the
most praises (but I see bug reports too). Perhaps worth a try to see if the problem is IDE
specific or elsewhere.

david.bernard
Joined: 2009-01-08,
User offline. Last seen 1 year 27 weeks ago.
Re: Re: How to access static methods of Java code?
Ask on the scala-ide-user@googlegroups.com mailing-list.Which version of ScalaIDE to you use (update-site) ?
try with http://download.scala-ide.org/update-1.0.0-milestones-2.8.1.final/

/davidB
On Mon, Mar 28, 2011 at 12:26, Philippe Lhoste <PhiLho@gmx.net> wrote:
On 27/03/2011 23:56, Nick Rudnick wrote:
Hope you prefer the following to some config files in this case (I am not sure), as the
code is minimal:

Looks OK, I suppose.
Perhaps it is a bug in the Eclipse plug-in, which is currently far from perfect, from the many reports I saw here and there.
So far I haven't tried any IDE plug-in for Scala, my Scala micro-projects are small enough to be manageable via a simple editor and the command line (and Gradle when I need to bring in some dependencies).

Note: currently in the IDE ecosystem of plug-ins for Scala, IntelliJ IDEA is getting the most praises (but I see bug reports too). Perhaps worth a try to see if the problem is IDE specific or elsewhere.

nilskp
Joined: 2009-01-30,
User offline. Last seen 1 year 27 weeks ago.
Re: Re: How to access static methods of Java code?
On Sun, Mar 27, 2011 at 9:02 AM, Nick Rudnick <nick.rudnick@googlemail.com> wrote:
Hi Philippe,
exactly: public synchronized static double getTime() of some Java class. 

I'm seeing the same thing. A synchronized static method. I've tried both 2.8.1 WIP backport and 2.0.0 beta.

Iulian Dragos
Joined: 2008-12-18,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: How to access static methods of Java code?
This exact code works fine for me with the latest nightly (downloaded from http://download.scala-ide.org/nightly-update-wip-experiment-trunk). Does it work on the command line (with the same jars on the classpath)?
cheers,iulian



On Sun, Mar 27, 2011 at 11:56 PM, Nick Rudnick <nick.rudnick@googlemail.com> wrote:
Hi Philippe,
I have some years of experience with Eclipse, but working at university it is below that of a smart professional.
Hope you prefer the following to some config files in this case (I am not sure), as the code is minimal:


Thanks and all the best, Nick

2011/3/27 Philippe Lhoste <PhiLho@gmx.net>
On 27/03/2011 20:15, Nick Rudnick wrote:
thank you very much, this led me into another direction -- I hadn't
tried this approach on the command line and did not expect it to be
working, as at the Eclipse IDE,

import de.renew.engine.searchqueue.SearchQueue

(with both paths in the Java build path) leads to the complaint

«value engine is not a member of package de.renew»,

for which I do not have solution, so that I moved the sources into a
separate Java project, after some googling didn't do the trick. So I am
trying to find out the meaning of this message now.

I am sorry if I state obvious things, but I don't know your level of expertise with Eclipse... :-)
Have you put the jars (of Renew and of Log4j) in the libraries part of your project?

nilskp
Joined: 2009-01-30,
User offline. Last seen 1 year 27 weeks ago.
Re: Re: How to access static methods of Java code?
On Thu, Apr 7, 2011 at 8:01 AM, iulian dragos <jaguarul@gmail.com> wrote:
This exact code works fine for me with the latest nightly (downloaded from http://download.scala-ide.org/nightly-update-wip-experiment-trunk). Does it work on the command line (with the same jars on the classpath)?

Does not work. I still get this:
value <static java method> is not a member of object <java class>  <file>

The method is synchronized, but I don't know if that is part of the problem.

This is a Scala project referencing several large Java projects. However I cannot reproduce a simple test case. And yes, this compiles fine using scalac on the command line.

I'm also seeing another bug. If I define a val (a Java class) in a package object, I cannot see it. If however I change the val to a def, it's now visible. Not sure if that's easily reproducible, as I'm unfortunately short on time.

nilskp
Joined: 2009-01-30,
User offline. Last seen 1 year 27 weeks ago.
Re: Re: How to access static methods of Java code?
Some further evidence: When I disable "optimise", both reported problems goes away on a clean build.

However adding -optimise to the scalac build does not break the build (I'm using Ant, so this is presuming that addparam works as advertised).

On Thu, Apr 7, 2011 at 9:06 AM, Nils Kilden-Pedersen <nilskp@gmail.com> wrote:
On Thu, Apr 7, 2011 at 8:01 AM, iulian dragos <jaguarul@gmail.com> wrote:
This exact code works fine for me with the latest nightly (downloaded from http://download.scala-ide.org/nightly-update-wip-experiment-trunk). Does it work on the command line (with the same jars on the classpath)?

Does not work. I still get this:
value <static java method> is not a member of object <java class>  <file>

The method is synchronized, but I don't know if that is part of the problem.

This is a Scala project referencing several large Java projects. However I cannot reproduce a simple test case. And yes, this compiles fine using scalac on the command line.

I'm also seeing another bug. If I define a val (a Java class) in a package object, I cannot see it. If however I change the val to a def, it's now visible. Not sure if that's easily reproducible, as I'm unfortunately short on time.


Iulian Dragos
Joined: 2008-12-18,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: How to access static methods of Java code?


On Thu, Apr 7, 2011 at 4:47 PM, Nils Kilden-Pedersen <nilskp@gmail.com> wrote:
Some further evidence: When I disable "optimise", both reported problems goes away on a clean build.

However adding -optimise to the scalac build does not break the build (I'm using Ant, so this is presuming that addparam works as advertised).

It's definitely more involved than just having a static synchronized Java method, as I could not reproduce it even after enabling -optimize in Eclipse. Sorry if I'm asking the obvious, but are you using the same version of the jars on the command line and the IDE? Is the problematic Java code part of the project (built by Eclipse as part of the same project), a dependent project inside Eclipse, or an external jar?
Regarding package objects, they need to be placed in the same directory as the package they are extending (the convention is to place them inside a file called 'package.scala'). Is that the case? When you say 'I cannot see them', it means you see errors while you type (red underlines) or when you build (in the Problems view), or both?
thanks for your help,iulian 


On Thu, Apr 7, 2011 at 9:06 AM, Nils Kilden-Pedersen <nilskp@gmail.com> wrote:
On Thu, Apr 7, 2011 at 8:01 AM, iulian dragos <jaguarul@gmail.com> wrote:
This exact code works fine for me with the latest nightly (downloaded from http://download.scala-ide.org/nightly-update-wip-experiment-trunk). Does it work on the command line (with the same jars on the classpath)?

Does not work. I still get this:
value <static java method> is not a member of object <java class>  <file>

The method is synchronized, but I don't know if that is part of the problem.

This is a Scala project referencing several large Java projects. However I cannot reproduce a simple test case. And yes, this compiles fine using scalac on the command line.

I'm also seeing another bug. If I define a val (a Java class) in a package object, I cannot see it. If however I change the val to a def, it's now visible. Not sure if that's easily reproducible, as I'm unfortunately short on time.





--
« Je déteste la montagne, ça cache le paysage »
Alphonse Allais
nilskp
Joined: 2009-01-30,
User offline. Last seen 1 year 27 weeks ago.
Re: Re: How to access static methods of Java code?
On Fri, Apr 8, 2011 at 3:10 AM, iulian dragos <jaguarul@gmail.com> wrote:
It's definitely more involved than just having a static synchronized Java method, as I could not reproduce it even after enabling -optimize in Eclipse. Sorry if I'm asking the obvious, but are you using the same version of the jars on the command line and the IDE?

No, I'm using 2.8.1 for command line.
 
Is the problematic Java code part of the project (built by Eclipse as part of the same project), a dependent project inside Eclipse, or an external jar?

Dependent project, inside Eclipse.
 
Regarding package objects, they need to be placed in the same directory as the package they are extending (the convention is to place them inside a file called 'package.scala'). Is that the case?

Yes.
 
When you say 'I cannot see them', it means you see errors while you type (red underlines) or when you build (in the Problems view), or both?

Both.

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland