score:0
i do not use eclipse, but have you tried this way?
object test extends app {
println("hello world")
}
score:0
your class isn't set as a class that can be launched.
you need to extend app
and put the body of your code directly in the class, like this:
package asd
object testobject extends app {
println("asda");
}
score:0
i just did a complete installation of eclipse and the scala ide for eclipse, created a runnable scala object using it and ran that object to produce the expected output with no problems. my installation platform is windows 7 x86_64. this is what i did:
downloaded eclipse-jee-luna-sr2-win32-x86_64.zip from columbia university at the eclipse downloads - mirror selection page at https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/luna/sr2/eclipse-jee-luna-sr2-win32-x86_64.zip
unbundled the download and updated its eclipse.ini file with -xms256m and -xmx2048m
created a new workspace folder
started eclipse by double clicking on eclipse.exe in the folder of the unbundled download and entered the pathname of the new workspace folder in its workspace launcher's select a workspace pop-up when it became available
in the running eclipse selected help > install new software... to get the available software pop-up, clicked on add in it to get the add repository pop-up and in that added the url for the scala ide for eclipse4.4 (luna) for scala 2.11.6 provided at http://scala-ide.org/download/current.html (the ide repo url is http://download.scala-ide.org/sdk/lithium/e44/scala211/stable/site) giving it the name "scala ide for eclipse4.4 (luna) for scala 2.11.6" and clicked ok.
in the resulting available software pop-up selected everything visible (scala ide for eclipse, scala ide for eclipse development support, scala ide for eclipse source feature, scala ide plugins (incubation) and sources), clicked on next and clicked on finish
after the installation finished it was required to restart eclipse so i did that
after the restart finished, in the running eclipse opened the scala perspecive by selecting window > open perspective > other > scala
created a new scala project by selecting file > new > scala project, giving it the name "helloworld" and clicked on finish
in the helloworld project right clicked on src and selected new > package, entered "tn" and clicked on finish
right clicked on the tn package in helloword/src, selected new > scala object, gave it the name "helloworld" and clicked on finish
in the editor window of the helloworld object that came up, added "extends app" to the object's definition and println("hello world") in its body. here are the contents of the helloworld.scala file:
package tn object helloworld extends app { println("hello world") }
ran the helloworld object by right clicking in its editor window and selecting run as > scala application which caused "hello world" to be printed in the console view
score:0
if your scala source has a main object like this:
package org.xx.yy
object mypackage extends app {
}
then in eclipse ide set "debug configurations->scala application->main class" to "org.xx.yy.mypackge"
score:3
though it is scala ide :) it still expects the class scala file to be found in the right package dir.
e.g. testobject.scala should be part of src/main/scala/asd
we too had to change the scala file location for our app main class to be able to debug it in scala ide. small nuisance.
Source: stackoverflow.com
Related Query
- Scala Main Class not found in Eclipse ide
- Scala Error: Could not find or load main class in both Scala IDE and Eclipse
- Scala IDE Error: Main method not found in class 'hello'
- Main class not found error while creating Maven Project in Scala IDE
- Could not find or load main class in scala in intellij IDE
- Scala IDE Error -could not find/load main class
- Error in running Scala Program: Main method not found in class main, please define the main method
- main class not found in spark scala program
- scala Ide Not identifying my class as main method
- Spark Scala Error - Error: Main method not found in class
- Scala IDE - Play 2 Eclipse Plug-in not highlighting syntax for Scala HTML Templates
- Scala deserialization: class not found
- Spark Scala getting class not found scala.Any
- Renaming a .scala file in Scala IDE does not rename the class
- Scala IDE not working properly in Eclipse Luna for Java EE
- Scala - IntelliJ IDEA Error: Could not find or load main class
- Eclipse Scala IDE - class file needed by X is missing
- Write an Arbitrary Value Not Found in a Case Class Using Play's (2.2) Scala JSON Combinators
- Eclipse scala "Could not find or load main class"
- Playframework, scala case class and property not found
- Test Class Not Found when Unit Testing on Scala
- Could not find or load main class (classname) in Scala Intellij
- Play framework scala Intellij IDE action not found
- EMR always gives me Class Not Found for Scala app
- Scala eclipse debugger present class constructed from json is not clear
- Error: Could not find or load main class with Spark in Eclipse
- Scala class not found on classpath when specifying jar in classpath
- Class not being built using Scala Eclipse plug-in
- Trying to read file from s3 with FLINK using the IDE getting Class org.apache.hadoop.fs.s3a.S3AFileSystem not found
- Dockerize a scala app: Could not find or load main class
More Query from same tag
- Scala: Grouping on the basis of inner list of objects
- How to add assign value to empty dataframe existing column in scala?
- UNRESOLVED DEPENDENCIES installing Deadbolt on Play Framework 2.2.1
- IntelliJ IDEA 12.0 Scala worksheet errors under Standard User account but works under Administrator
- Optional Fields, ADT, or?
- Scala Slick store only selected fields of the case class
- scala downcasting with generics
- Getting size of s3 directory in spark scala
- Not sure about what the error messages are trying to convey
- Why is the best way to avoid being trapped by Scala's abstract type refinement?
- Is it possible to open a interactive vim process by Scala REPL shell command?
- Scala Fork-Join-All With Multiple Generic Types and 1 Generic Unit of Work
- Type mismatch error when assigning literal to Float
- Is there any way to mock Singleton object in Scala
- Pattern match an array of Regex's in Scala
- Why it is allowed to point to constructors parameters?
- Can I override the toString method of an anonymous function in Scala?
- Scala-Declaring variables when using Try,Success and Failure for error handling?
- What's the effect of -Yrangepos other than giving me source locations in macros
- How can I avoid Slick's model declaration verbosity and repetitiveness
- Why can't I assign Nothing to a variable of type Unit?
- Class not found in simple spark application
- Eliminate duplicates (deduplication) in Streaming DataFrame
- Catching an exception within a map
- Slick and filtering by Option columns
- How printf works in scala?
- Apply UDF to multiple columns in Spark Dataframe
- Deadbolt 2 in Scala ask if user has access to route
- Removing string element off list by index id in Scala
- Run sbt with -Ylog-classpath