|
View:
New views
9 Messages
—
Rating Filter:
Alert me
|
|
|
dangerous import java.sql._Hi everybody!
Yet another simple and mysterious problem: with the "import" statement, running the code will generate a "Exception in thread "main" java.lang.NoSuchMethodError: main". Removing the "import" solves the problem. What am I missing? Changing the name of the object does not modify the outcome. Thanks! import java.sql._ // remove this line to get rid of the error msg object Sqltest { def main(args: Array[String]) { print("OK") } } |
|
|
Re: dangerous import java.sql._I shan't spoil it for you, but I shall give ye a hint.
When one alters Array for the word scala.Array then all is well. turicum wrote: > Hi everybody! > > Yet another simple and mysterious problem: with the "import" statement, > running the code will generate a "Exception in thread "main" > java.lang.NoSuchMethodError: main". Removing the "import" solves the > problem. What am I missing? Changing the name of the object does not modify > the outcome. Thanks! > > import java.sql._ // remove this line to get rid of the error msg > > object Sqltest { > def main(args: Array[String]) { > print("OK") > } > } > > > -- Tony Morris http://tmorris.net/ |
|
|
Re: dangerous import java.sql._thank you for the prompt reply!
everything's fine now :) Alex
|
|
|
Re: dangerous import java.sql._Good job, then we shall reveal the problem for all!
The import causes the main method to use java.sql.Array thus making it an invalid main method for execution. turicum wrote: > thank you for the prompt reply! > everything's fine now :) > Alex > > > Tony Morris-4 wrote: > >> I shan't spoil it for you, but I shall give ye a hint. >> >> When one alters Array for the word scala.Array then all is well. >> >> turicum wrote: >> >>> Hi everybody! >>> >>> Yet another simple and mysterious problem: with the "import" statement, >>> running the code will generate a "Exception in thread "main" >>> java.lang.NoSuchMethodError: main". Removing the "import" solves the >>> problem. What am I missing? Changing the name of the object does not >>> modify >>> the outcome. Thanks! >>> >>> import java.sql._ // remove this line to get rid of the error msg >>> >>> object Sqltest { >>> def main(args: Array[String]) { >>> print("OK") >>> } >>> } >>> >>> >>> >>> >> -- >> Tony Morris >> http://tmorris.net/ >> >> >> >> >> > > -- Tony Morris http://tmorris.net/ |
|
|
Re: dangerous import java.sql._In that case, maybe this will help as well:
import java.sql.{Array=>SQLArray, _}
On Wed, Jul 8, 2009 at 8:55 PM, turicum <turicum@...> wrote:
-- Daniel C. Sobral Something I learned in academia: there are three kinds of academic reviews: review by name, review by reference and review by value. |
|
|
Re: dangerous import java.sql._java.sql package includes Array interface. I think, with importing you
overwrite scala.Array. Ar a result, you have, in fact, def main(args: java.sql.Array[String]) instead of def main(args: scala.Array[String]) As far as main's signature is not expected for legal 'main' method, you get java.lang.NoSuchMethodError. On Thursday 09 July 2009 03:55:10 turicum wrote: > thank you for the prompt reply! > everything's fine now :) > Alex > > Tony Morris-4 wrote: > > I shan't spoil it for you, but I shall give ye a hint. > > > > When one alters Array for the word scala.Array then all is well. > > > > turicum wrote: > >> Hi everybody! > >> > >> Yet another simple and mysterious problem: with the "import" statement, > >> running the code will generate a "Exception in thread "main" > >> java.lang.NoSuchMethodError: main". Removing the "import" solves the > >> problem. What am I missing? Changing the name of the object does not > >> modify > >> the outcome. Thanks! > >> > >> import java.sql._ // remove this line to get rid of the error msg > >> > >> object Sqltest { > >> def main(args: Array[String]) { > >> print("OK") > >> } > >> } > > > > -- > > Tony Morris > > http://tmorris.net/ |
|
|
Re: dangerous import java.sql._On Thursday 09 July 2009 03:59:43 Daniel Sobral wrote:
> In that case, maybe this will help as well: > import java.sql.{Array=>SQLArray, _} .. or full qualifying scala.Array type in main's parameters list. |
|
|
Re: dangerous import java.sql._I'd suggest not using _ in imports.
2009/7/9 Andrew Gaydenko <a@...>: > On Thursday 09 July 2009 03:59:43 Daniel Sobral wrote: >> In that case, maybe this will help as well: >> import java.sql.{Array=>SQLArray, _} > > .. or full qualifying scala.Array type in main's parameters list. > > -- Ricky Clarkson Java Programmer, AD Holdings +44 1565 770804 Skype: ricky_clarkson Google Talk: ricky.clarkson@... |
|
|
Re: dangerous import java.sql._On Thursday 09 July 2009 13:29:26 Ricky Clarkson wrote:
> I'd suggest not using _ in imports. +1 to my taste (going from avoiding * in Java). > > 2009/7/9 Andrew Gaydenko <a@...>: > > On Thursday 09 July 2009 03:59:43 Daniel Sobral wrote: > >> In that case, maybe this will help as well: > >> import java.sql.{Array=>SQLArray, _} > > > > .. or full qualifying scala.Array type in main's parameters list. |
| Free embeddable forum powered by Nabble | Forum Help |