- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Re: Still problems trying to define scalatest task
Sun, 2009-08-02, 21:58
ext lets you have jars always be in the classpath implicitly. I don't think you need it.
-------------------------------------
Kenneth McDonald wrote:
Thanks for the replies, Bill and Naftoli. Don't apologize for being away
from the net on a weekend, that's probably a good thing :-)
I'm invoking Ant from the Eclipse UI, hence I assume it is probably
using
the ant file that comes bundled with Eclipse:
/Applications/eclipse/plugins/org.apache.ant_1.7.1.v20090120-1145/lib/
ant.jar
If I copy this file to the standard extensions directory, am I likely
to create conflicts?
I don't know enough about the classloader mechanism to answer this for
myself.
(Obviously I'd have to update when a new version of eclipse comes out,
but that's
a problem for another day.)
Thanks,
Ken
On Aug 2, 2009, at 2:28 PM, Naftoli Gugenheim wrote:
> I believe Eclipse lets you specify a custom classpath in the Ant
> Build launch configuration dialog.
>
> On Sun, Aug 2, 2009 at 3:25 PM, Bill Venners wrote:
> Hi Kenneth,
>
> Sorry I was away from the net for a couple days. I think the problem
> may be that you have put the scalatest.jar file in your Java standard
> extensions directory, but haven't put the ant.jar file one there. The
> JVM loads classes from Jar files located in the standard extensions
> directory in its own class loader, which is a parent class loader from
> the classpath class loader. The ScalaTest ant task indeed depends on
> the ant Jar file, so it needs to be accessible from the same or a
> parent class loader. So the solution would be to either move the
> ScalaTest Jar file to the classpath, which is where Ant probably is,
> or to put ant in the standard extensions directory. Give that a try
> and let us know if it meets with success.
>
> Bill
>
> On Sat, Aug 1, 2009 at 11:13 AM, Kenneth
> McDonald wrote:
> > I have the following in my build.xml file:
> > classname="org.scalatest.tools.ScalaTestTask">
> >
> >
> >
> >
> >
> >
> > This gives no static error or warnings (finally!), but when I try
> to run the
> > file, I get:
> > /Users/Ken/Documents/workspace/rex/build.xml:44: taskdef A class
> needed by
> > class org.scalatest.tools.ScalaTestTask cannot be found:
> > org/apache/tools/ant/Task
> > where line 44 is the start of the 'scalatest' taskdef definition.
> Do I need
> > to add in ant files to the path as well?
> > Thanks,
> > Ken
>
>
>
> --
> Bill Venners
> Artima, Inc.
> http://www.artima.com
>
Mon, 2009-08-03, 17:07
#2
Re: Still problems trying to define scalatest task
On Aug 2, 2009, at 9:02 PM, Naftoli Gugenheim wrote:
VM arguments: -Denv.class.path=/usr/share/ant/lib/ant.jar -Dapplication.home=/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home Class path: /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/jconsole.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/tools.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/classes
The presence of ant.jar in the classpath is because I put it there, of course. Unfortunately, I'm still getting the error message:
/Users/Ken/Documents/workspace/rex/build.xml:70: taskdef A class needed by class org.scalatest.tools.ScalaTestTask cannot be found: org/apache/tools/ant/Task
which occurs as a result of the taskdef:
<taskdef name="scalatest" classname="org.scalatest.tools.ScalaTestTask"> <classpath> <pathelement location="/Applications/eclipse/plugins/org.apache.ant_1.7.1.v20090120-1145/lib/scalatest.jar" /> <pathelement location="${scala.home}/lib/scala-compiler.jar" /> <pathelement location="${scala-library.jar}" /> </classpath> </taskdef>
Again, thanks for the help,Ken
Can you get the ant file to pause and jconsole into it? That will tell you what classpath and vm arguments it's running with (if regular task managers don't give you enough information).Hey, that's pretty neat! I never new about JConsole. In any case:
VM arguments: -Denv.class.path=/usr/share/ant/lib/ant.jar -Dapplication.home=/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home Class path: /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/jconsole.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/tools.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/classes
The presence of ant.jar in the classpath is because I put it there, of course. Unfortunately, I'm still getting the error message:
/Users/Ken/Documents/workspace/rex/build.xml:70: taskdef A class needed by class org.scalatest.tools.ScalaTestTask cannot be found: org/apache/tools/ant/Task
which occurs as a result of the taskdef:
<taskdef name="scalatest" classname="org.scalatest.tools.ScalaTestTask"> <classpath> <pathelement location="/Applications/eclipse/plugins/org.apache.ant_1.7.1.v20090120-1145/lib/scalatest.jar" /> <pathelement location="${scala.home}/lib/scala-compiler.jar" /> <pathelement location="${scala-library.jar}" /> </classpath> </taskdef>
Again, thanks for the help,Ken
Mon, 2009-08-03, 17:17
#3
Re: Still problems trying to define scalatest task
I don't see ant.jar in the classpath
On Mon, Aug 3, 2009 at 11:58 AM, Kenneth McDonald <kenneth.m.mcdonald@sbcglobal.net> wrote:
On Mon, Aug 3, 2009 at 11:58 AM, Kenneth McDonald <kenneth.m.mcdonald@sbcglobal.net> wrote:
On Aug 2, 2009, at 9:02 PM, Naftoli Gugenheim wrote:Can you get the ant file to pause and jconsole into it? That will tell you what classpath and vm arguments it's running with (if regular task managers don't give you enough information).Hey, that's pretty neat! I never new about JConsole. In any case:
VM arguments: -Denv.class.path=/usr/share/ant/lib/ant.jar -Dapplication.home=/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home Class path: /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/jconsole.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/tools.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/classes
The presence of ant.jar in the classpath is because I put it there, of course. Unfortunately, I'm still getting the error message:
/Users/Ken/Documents/workspace/rex/build.xml:70: taskdef A class needed by class org.scalatest.tools.ScalaTestTask cannot be found: org/apache/tools/ant/Task
which occurs as a result of the taskdef:
<taskdef name="scalatest" classname="org.scalatest.tools.ScalaTestTask"> <classpath> <pathelement location="/Applications/eclipse/plugins/org.apache.ant_1.7.1.v20090120-1145/lib/scalatest.jar" /> <pathelement location="${scala.home}/lib/scala-compiler.jar" /> <pathelement location="${scala-library.jar}" /> </classpath> </taskdef>
Again, thanks for the help, Ken
Mon, 2009-08-03, 18:27
#4
Re: Still problems trying to define scalatest task
What jars are in Ant home in the dialog you posted? Are you sure you connected to the right Java process? Why does it have jconsole in the classpath?I fired up the scala interpreter and jconsole'd into it, and here is what it says, just for comparison.
Version:0.9
StartHTML:-1
EndHTML:-1
StartFragment:0000000111
EndFragment:0000003910
VM arguments:
-Xmx256M -Xms32M
-Dscala.home=C:\dev\Scala\bin\.. -Denv.classpath= -Denv.emacs=
Class path:
C:\dev\Scala\bin\..\lib\bcprov-jdk14.jar;C:\dev\Scala\bin\..\lib\jaxen-core.jar;C:\dev\Scala\bin\..\lib\jaxen-jdom.jar;C:\dev\Scala\bin\..\lib\jdom.jar;C:\dev\Scala\bin\..\lib\jetty.jar;C:\dev\Scala\bin\..\lib\jxta.jar;C:\dev\Scala\bin\..\lib\jxtaext.jar;C:\dev\Scala\bin\..\lib\log4j.jar;C:\dev\Scala\bin\..\lib\saxpath.jar;C:\dev\Scala\bin\..\lib\sbaz-tests.jar;C:\dev\Scala\bin\..\lib\sbaz.jar;C:\dev\Scala\bin\..\lib\scala-actors-examples.jar;C:\dev\Scala\bin\..\lib\scala-actors-jxta.jar;C:\dev\Scala\bin\..\lib\scala-compiler.jar;C:\dev\Scala\bin\..\lib\scala-dbc.jar;C:\dev\Scala\bin\..\lib\scala-library.jar;C:\dev\Scala\bin\..\lib\scala-swing.jar;C:\dev\Scala\bin\..\lib\servlet-api.jar
Library path:
c:\Program Files\dev\Java\jdk1.6.0_14\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program
Files (x86)\dev\JavaFX\javafx-sdk1.2\bin;C:\Program Files
(x86)\dev\JavaFX\javafx-sdk1.2\emulator\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program
Files (x86)\CyberLink\Power2Go;C:\Program Files
(x86)\audio\LilyPond\usr\bin;C:\Windows\System32\WindowsPowerShell\v1.0\;c:\dev\maven\bin;c:\Program
Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program
Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program
Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program
Files\dev\MySQL\MySQL Server 5.1\bin;"C:\Program Files
(x86)\dev\Zend\ZendServer\bin";"C:\Program Files
(x86)\dev\Zend\ZendServer\share\ZendFramework\bin";C:\Program
Files (x86)\util\Bitvise Tunnelier;c:\Program Files
(x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;c:\Program
Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program
Files\Microsoft Network Monitor 3\
Boot class path:
c:\Program
Files\dev\Java\jdk1.6.0_14\jre\lib\resources.jar;c:\Program
Files\dev\Java\jdk1.6.0_14\jre\lib\rt.jar;c:\Program
Files\dev\Java\jdk1.6.0_14\jre\lib\sunrsasign.jar;c:\Program
Files\dev\Java\jdk1.6.0_14\jre\lib\jsse.jar;c:\Program
Files\dev\Java\jdk1.6.0_14\jre\lib\jce.jar;c:\Program
Files\dev\Java\jdk1.6.0_14\jre\lib\charsets.jar;c:\Program
Files\dev\Java\jdk1.6.0_14\jre\classes
On Mon, Aug 3, 2009 at 12:14 PM, Kenneth McDonald <kenneth.m.mcdonald@sbcglobal.net> wrote:
On Mon, Aug 3, 2009 at 12:14 PM, Kenneth McDonald <kenneth.m.mcdonald@sbcglobal.net> wrote:
It's in the VM arguments: -Denv.class.path, which was picked up from the CLASSPATH environment variable. Does this not work? If so, what's the correct way to do it?
Sorry for all the questions. After not having programmed in Java since about 1.2, I'm trying to learn a whole bunch of things at once.
Thanks,Ken
On Aug 3, 2009, at 11:04 AM, Naftoli Gugenheim wrote:I don't see ant.jar in the classpath
On Mon, Aug 3, 2009 at 11:58 AM, Kenneth McDonald <kenneth.m.mcdonald@sbcglobal.net> wrote:
On Aug 2, 2009, at 9:02 PM, Naftoli Gugenheim wrote:Can you get the ant file to pause and jconsole into it? That will tell you what classpath and vm arguments it's running with (if regular task managers don't give you enough information).Hey, that's pretty neat! I never new about JConsole. In any case:
VM arguments: -Denv.class.path=/usr/share/ant/lib/ant.jar -Dapplication.home=/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home Class path: /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/jconsole.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/tools.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/classes
The presence of ant.jar in the classpath is because I put it there, of course. Unfortunately, I'm still getting the error message:
/Users/Ken/Documents/workspace/rex/build.xml:70: taskdef A class needed by class org.scalatest.tools.ScalaTestTask cannot be found: org/apache/tools/ant/Task
which occurs as a result of the taskdef:
<taskdef name="scalatest" classname="org.scalatest.tools.ScalaTestTask"> <classpath> <pathelement location="/Applications/eclipse/plugins/org.apache.ant_1.7.1.v20090120-1145/lib/scalatest.jar" /> <pathelement location="${scala.home}/lib/scala-compiler.jar" /> <pathelement location="${scala-library.jar}" /> </classpath> </taskdef>
Again, thanks for the help, Ken
Mon, 2009-08-03, 18:37
#5
Re: Still problems trying to define scalatest task
(Don't know where "Version:0.9 StartHTML:-1 EndHTML:-1 StartFragment:0000000111 EndFragment:0000003910" came from...)
On Mon, Aug 3, 2009 at 1:25 PM, Naftoli Gugenheim <naftoligug@gmail.com> wrote:
On Mon, Aug 3, 2009 at 1:25 PM, Naftoli Gugenheim <naftoligug@gmail.com> wrote:
What jars are in Ant home in the dialog you posted? Are you sure you connected to the right Java process? Why does it have jconsole in the classpath?I fired up the scala interpreter and jconsole'd into it, and here is what it says, just for comparison. Version:0.9 StartHTML:-1 EndHTML:-1 StartFragment:0000000111 EndFragment:0000003910 VM arguments: -Xmx256M -Xms32M -Dscala.home=C:\dev\Scala\bin\.. -Denv.classpath= -Denv.emacs= Class path: C:\dev\Scala\bin\..\lib\bcprov-jdk14.jar;C:\dev\Scala\bin\..\lib\jaxen-core.jar;C:\dev\Scala\bin\..\lib\jaxen-jdom.jar;C:\dev\Scala\bin\..\lib\jdom.jar;C:\dev\Scala\bin\..\lib\jetty.jar;C:\dev\Scala\bin\..\lib\jxta.jar;C:\dev\Scala\bin\..\lib\jxtaext.jar;C:\dev\Scala\bin\..\lib\log4j.jar;C:\dev\Scala\bin\..\lib\saxpath.jar;C:\dev\Scala\bin\..\lib\sbaz-tests.jar;C:\dev\Scala\bin\..\lib\sbaz.jar;C:\dev\Scala\bin\..\lib\scala-actors-examples.jar;C:\dev\Scala\bin\..\lib\scala-actors-jxta.jar;C:\dev\Scala\bin\..\lib\scala-compiler.jar;C:\dev\Scala\bin\..\lib\scala-dbc.jar;C:\dev\Scala\bin\..\lib\scala-library.jar;C:\dev\Scala\bin\..\lib\scala-swing.jar;C:\dev\Scala\bin\..\lib\servlet-api.jar Library path: c:\Program Files\dev\Java\jdk1.6.0_14\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\dev\JavaFX\javafx-sdk1.2\bin;C:\Program Files (x86)\dev\JavaFX\javafx-sdk1.2\emulator\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files (x86)\CyberLink\Power2Go;C:\Program Files (x86)\audio\LilyPond\usr\bin;C:\Windows\System32\WindowsPowerShell\v1.0\;c:\dev\maven\bin;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\dev\MySQL\MySQL Server 5.1\bin;"C:\Program Files (x86)\dev\Zend\ZendServer\bin";"C:\Program Files (x86)\dev\Zend\ZendServer\share\ZendFramework\bin";C:\Program Files (x86)\util\Bitvise Tunnelier;c:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;c:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Microsoft Network Monitor 3\ Boot class path: c:\Program Files\dev\Java\jdk1.6.0_14\jre\lib\resources.jar;c:\Program Files\dev\Java\jdk1.6.0_14\jre\lib\rt.jar;c:\Program Files\dev\Java\jdk1.6.0_14\jre\lib\sunrsasign.jar;c:\Program Files\dev\Java\jdk1.6.0_14\jre\lib\jsse.jar;c:\Program Files\dev\Java\jdk1.6.0_14\jre\lib\jce.jar;c:\Program Files\dev\Java\jdk1.6.0_14\jre\lib\charsets.jar;c:\Program Files\dev\Java\jdk1.6.0_14\jre\classes
On Mon, Aug 3, 2009 at 12:14 PM, Kenneth McDonald <kenneth.m.mcdonald@sbcglobal.net> wrote:
It's in the VM arguments: -Denv.class.path, which was picked up from the CLASSPATH environment variable. Does this not work? If so, what's the correct way to do it?
Sorry for all the questions. After not having programmed in Java since about 1.2, I'm trying to learn a whole bunch of things at once.
Thanks,Ken
On Aug 3, 2009, at 11:04 AM, Naftoli Gugenheim wrote:I don't see ant.jar in the classpath
On Mon, Aug 3, 2009 at 11:58 AM, Kenneth McDonald <kenneth.m.mcdonald@sbcglobal.net> wrote:
On Aug 2, 2009, at 9:02 PM, Naftoli Gugenheim wrote:Can you get the ant file to pause and jconsole into it? That will tell you what classpath and vm arguments it's running with (if regular task managers don't give you enough information).Hey, that's pretty neat! I never new about JConsole. In any case:
VM arguments: -Denv.class.path=/usr/share/ant/lib/ant.jar -Dapplication.home=/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home Class path: /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/jconsole.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/tools.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/classes
The presence of ant.jar in the classpath is because I put it there, of course. Unfortunately, I'm still getting the error message:
/Users/Ken/Documents/workspace/rex/build.xml:70: taskdef A class needed by class org.scalatest.tools.ScalaTestTask cannot be found: org/apache/tools/ant/Task
which occurs as a result of the taskdef:
<taskdef name="scalatest" classname="org.scalatest.tools.ScalaTestTask"> <classpath> <pathelement location="/Applications/eclipse/plugins/org.apache.ant_1.7.1.v20090120-1145/lib/scalatest.jar" /> <pathelement location="${scala.home}/lib/scala-compiler.jar" /> <pathelement location="${scala-library.jar}" /> </classpath> </taskdef>
Again, thanks for the help, Ken
Can you get the ant file to pause and jconsole into it? That will tell you what classpath and vm arguments it's running with (if regular task managers don't give you enough information).
-------------------------------------
Kenneth McDonald wrote:
On Aug 2, 2009, at 2:28 PM, Naftoli Gugenheim wrote:
> I believe Eclipse lets you specify a custom classpath in the Ant
> Build launch configuration dialog.
>
Do you mean like this?:
If so, thanks for the suggestion, but it doesn't solve the problem.
Sigh.
Ken