Code Monkey home page Code Monkey logo

scalafx-hello-world's Introduction

ScalaFX

Join the chat at https://gitter.im/scalafx/scalafx

Scala CI Maven Central Scaladoc

ScalaFX is a UI DSL written within the Scala Language that sits on top of JavaFX. This means that every ScalaFX application is also a valid Scala application. By extension, it supports full interoperability with Java and can run anywhere the Java Virtual Machine (JVM) and JavaFX are supported.

If you have ScalaFX related questions please use ScalaFX Discussions, or ScalaFX Users Group, or ScalaFX on StackOverflow. Please report any problems using ScalaFX Issue Tracker.

Getting Started

ScalaFX binaries are published in the Maven Central repository: http://search.maven.org/#search|ga|1|scalafx

The official website for ScalaFX is http://scalafx.org.

ScalaFX Dependencies

ScalaFX 11+ is the current actively maintained version. ScalaFX 11+ is intended to support Java 11 and newer.

SBT

Here is how you can add dependency using SBT.

libraryDependencies += "org.scalafx" %% "scalafx" % "21.0.0-R32"

Note that in ScalaFX version prior to 20.0.0-R31 and SBT older than 1.6, you needed to explicitly provide dependency on JavaFX modules including platform dependent modules. This is no longer needed.

You can find examples of SBT setup in section Demo Projects and Examples below.

Mill

If you're using Mill:

object yourProject extends ScalaModule {
  def scalaVersion = "3.0.0"

  // Customize coursier resolution to discover the OS-specific artifacts required by JavaFX
  // Note: this requires mill >= 0.9.7 (with pr/775 merged)
  def resolutionCustomizer = T.task {
    Some((r: coursier.core.Resolution) =>
      r.withOsInfo(coursier.core.Activation.Os.fromProperties(sys.props.toMap))
    )
  }

  // Add dependency on JavaFX libraries
  val javaFXVersion = "16"
  val scalaFXVersion = "16.0.0-R25"
  val javaFXModules = List("base", "controls", "fxml", "graphics", "media", "swing", "web")
    .map(m => ivy"org.openjfx:javafx-$m:$javaFXVersion")

  def ivyDeps = {
    Agg(
      ivy"org.scalafx::scalafx:$scalaFXVersion",
      //...
    ) ++ javaFXModules
  }
}

You can find sample ScalaFX Mill project here: scalafx-millproject

Gradle

Example of build.gradle:

plugins {
    id 'scala'
    id 'application'
    id 'org.openjfx.javafxplugin' version '0.0.13'
}

repositories {
    mavenCentral()
}

javafx {
    version = "21"
    modules = ['javafx.controls', 'javafx.media']
}

dependencies {
    implementation 'org.scala-lang:scala3-library_3:3.3.1'
    implementation 'org.scalafx:scalafx_3:21.0.0-R32'
}

application {
    mainClass = 'hello.ScalaFXHelloWorld'
}

A complete sample Gradle project can ge found in ScalaFX-Hello-World-Gradle.

What is in the version number

ScalaFX version number has two part. The first part corresponds to the latest JavaFX version it was tested with. The second part is an incremental release number. For instance, version 15.0.1-R20 means that it was tested with JavaFX version 15.0.1 and that is the 20th release of ScalaFX.

Legacy Releases

ScalaFX 10

with Java 10 use:

libraryDependencies += "org.scalafx" %% "scalafx" % "10.0.2-R15"
ScalaFX 8

To use ScalaFX with SBT and Java 8 add following dependency (to use the latest scalafx you might need Java version at least 1.8.40):

libraryDependencies += "org.scalafx" %% "scalafx" % "8.0.192-R14"
ScalaFX 2

With Java 7 use:

libraryDependencies += "org.scalafx" %% "scalafx" % "2.2.76-R11"

Demo Projects and Examples

The ScalaFX Organization page on GitHub contains several sample project that illustrate use of ScalaFX. The simplest one, and recommended to start with, is scalafx-hello-world. There is also a Gradle version here: ScalaFX-Hello-World-Gradle.

Development Snapshots

Snapshot releases are also regularly published on Sonatype Snapshots. To use a snapshot build you may need to add "Sonatype OSS Snapshots" resolver to you SBT configuration:

resolvers += Opts.resolver.sonatypeSnapshots

If you just want to download a recent snapshot build you can also use Travis CI build site https://travis-ci.org/scalafx/scalafx

Software License

This software licensed under BSD Open Source.

The License text for this software can be found in LICENSE.txt in the root folder of the project.

Software Required

The following software is needed to build ScalaFX:

  1. SBT v.1.6.0 or better
  2. Scala. ScalaFX 12 builds with Scala 2.10.2 or newer.
  3. Java 17 or better is required as of JavaFX 20 / ScalaFX 20.0.0-R31 (this is JavaFX 20 requirement

It works with Windows, Mac OS X, and Linux ports.

Project Structure

The current project directory structure:

./notes
./project
./scalafx
./scalafx-demos

Where . is the root folder of the project.

The notes folder contains release notes for past releases.

The scalafx folder is the sub-project for the ScalaFX Framework.

The scalafx-demos is the sub-project for the ScalaFX Framework Demonstrations, some are a bit out of date, help needed here :).

The project folder is reserved for SBT build system setup.

Source Code Branching Policy

The current development is for ScalaFX 20. The development is done on the master branch. Releases are done on the stable branch. Releases are tagged with version number. Pull requests are only accepted off a branch created from the master branch. When working on a pull request, create a separate branch for each feature or bug fix. This way the main development branch is not blocked by a pull request and pull requests are easier to merge individually.

The ScalaFX 8 and 2.2 development is no longer active. For those who need it, the code is on branches: SFX-8 and SFX-2. Past releases are on SFX-8-stable and SFX-2-stable branches.

Authors

ScalaFX was originally created by Stephen Chin, Java Champion, Oracle JavaOne program chair; and Sven Reimers, a member of the Netbeans Dream Team.

Credits

The most up to date list of contributors to the project can be found on the Contributors page.

Community

We request all the team members to follow the Typelevel Code of Conduct in our mailing list, issue discussion, Gitter room or any of ScalaFX meetups.

For more info on Contribute, check our Contributing page.

scalafx-hello-world's People

Contributors

esamson avatar jpsacha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scalafx-hello-world's Issues

Example using Scala 3 (a.k.a dotty)

Scala 3 is mostly backward compatible with Scala 2.13. It maybe possible to use ScalaFX build with Scala 2.13 with Scala 3. Modify scalafx-hello-world so it can be used from Scala 3

Dependencies not compiling

I'm getting the following errors

sbt:ScalaFX Hello World> run
[info] Updating {file:/home/drew/tmp/scalafx-hello-world/}scalafx-hello-world...
[info] Done updating.
[info] Compiling 1 Scala source to /home/drew/tmp/scalafx-hello-world/target/scala-2.12/classes ...
[info] Non-compiled module 'compiler-bridge_2.12' for Scala 2.12.4. Compiling...
[info]   Compilation completed in 10.344s.
[error] /home/drew/tmp/scalafx-hello-world/src/main/scala/hello/ScalaFXHelloWorld.scala:42:3: Symbol 'type javafx.event.EventTarget' is missing from the classpath.
[error] This symbol is required by 'class scalafx.stage.Window'.
[error] Make sure that type EventTarget is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.
[error] A full rebuild may help if 'Window.class' was compiled against an incompatible version of javafx.event.
[error]   stage = new PrimaryStage {
[error]   ^
[error] /home/drew/tmp/scalafx-hello-world/src/main/scala/hello/ScalaFXHelloWorld.scala:45:17: Symbol 'term javafx.css' is missing from the classpath.
[error] This symbol is required by 'trait scalafx.css.Styleable'.
[error] Make sure that term css is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.
[error] A full rebuild may help if 'Styleable.class' was compiled against an incompatible version of javafx.
[error]     scene = new Scene {
[error]                 ^
[error] /home/drew/tmp/scalafx-hello-world/src/main/scala/hello/ScalaFXHelloWorld.scala:45:5: Symbol 'type javafx.scene.Scene' is missing from the classpath.
[error] This symbol is required by 'class scalafx.scene.Scene'.
[error] Make sure that type Scene is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.
[error] A full rebuild may help if 'Scene.class' was compiled against an incompatible version of javafx.scene.
[error]     scene = new Scene {
[error]     ^
[error] /home/drew/tmp/scalafx-hello-world/src/main/scala/hello/ScalaFXHelloWorld.scala:50:15: Symbol 'type javafx.scene.text.Text' is missing from the classpath.
[error] This symbol is required by 'class scalafx.scene.text.Text'.
[error] Make sure that type Text is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.
[error] A full rebuild may help if 'Text.class' was compiled against an incompatible version of javafx.scene.text.
[error]           new Text {
[error]               ^
[error] /home/drew/tmp/scalafx-hello-world/src/main/scala/hello/ScalaFXHelloWorld.scala:53:24: Symbol 'term javafx.scene.paint' is missing from the classpath.
[error] This symbol is required by 'class scalafx.scene.paint.LinearGradient'.
[error] Make sure that term paint is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.
[error] A full rebuild may help if 'LinearGradient.class' was compiled against an incompatible version of javafx.scene.
[error]             fill = new LinearGradient(
[error]                        ^
[error] /home/drew/tmp/scalafx-hello-world/src/main/scala/hello/ScalaFXHelloWorld.scala:64:26: Symbol 'type javafx.scene.effect.DropShadow' is missing from the classpath.
[error] This symbol is required by 'class scalafx.scene.effect.DropShadow'.
[error] Make sure that type DropShadow is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.
[error] A full rebuild may help if 'DropShadow.class' was compiled against an incompatible version of javafx.scene.effect.
[error]             effect = new DropShadow {
[error]                          ^
[error] 6 errors found
[error] (compile:compileIncremental) Compilation failed
[error] Total time: 11 s, completed Nov 12, 2017 10:50:36 AM
sbt:ScalaFX Hello World> 

Compile via Gradle

I've been trying to get this hello world to work, in a Gradle project. It does not want to compile for me. I don't know what the problem is.

In a plain Scala 3 setup (no ScalaFX), it works for me.

I'm using Scala version 3.2.2. I did not try other versions yet, as it's really cumbersome to get all dependencies in the exact version matching a Scala version.

Here is my build.gradle.kts:

plugins {
    scala
    application
    id("org.openjfx.javafxplugin") version "0.0.13" // not sure if this is needed
}

tasks.withType<ScalaCompile> {
    scalaCompileOptions.additionalParameters.addAll(listOf( // these seem to not do anything
        "-feature",
        "-explain",
        "-Ysafe-init",
        "-Ydebug-unpickling",
        "-unchecked",
        "-deprecation",
        "-encoding", "utf8",
        "-Xsemanticdb"
    ))
}

repositories {
    mavenCentral()
}

dependencies {
    implementation("org.scala-lang:scala3-library_3:3.2.2")
    implementation("org.scalafx:scalafx_3:19.0.0-R30")
}

testing {
    suites {
        val test by getting(JvmTestSuite::class) {
            useJUnit("4.13.2")
            dependencies {
                implementation("org.scalatest:scalatest_3:3.2.15")
                implementation("org.scalatestplus:junit-4-13_3:3.2.15.0")
            }
        }
    }
}

application {
    mainClass.set("scala.project.App")
}

App here is the the hello world example just renamed. I've also tried the Scala 2 syntax from the scaladoc, with same results.

When trying to compile, I get this:

> Task :app:compileScala
[Warn] : Flag -unchecked set repeatedly
[Warn] : Flag -deprecation set repeatedly
java.lang.AssertionError: assertion failed: class Window has non-class parent: val <none>
	at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.traverse$1(SymDenotations.scala:1912)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeBaseData(SymDenotations.scala:1917)
	at dotty.tools.dotc.core.SymDenotations$BaseDataImpl.apply(SymDenotations.scala:2889)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseData(SymDenotations.scala:1883)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseClassSet(SymDenotations.scala:1899)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.derivesFrom(SymDenotations.scala:1925)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.isValueClass(SymDenotations.scala:821)
	at dotty.tools.dotc.transform.ValueClasses$.isDerivedValueClass(ValueClasses.scala:19)
	at dotty.tools.dotc.core.TypeErasure.dotty$tools$dotc$core$TypeErasure$$sigName(TypeErasure.scala:822)
	at dotty.tools.dotc.core.TypeErasure$.sigName(TypeErasure.scala:204)
	at dotty.tools.dotc.core.Signature$.apply(Signature.scala:167)
	at dotty.tools.dotc.core.Types$MethodOrPoly.computeSignature$2(Types.scala:3678)
	at dotty.tools.dotc.core.Types$MethodOrPoly.signature(Types.scala:3699)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.signature(Denotations.scala:615)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.signature(Denotations.scala:605)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.atSignature(Denotations.scala:647)
	at dotty.tools.dotc.core.Denotations$SingleDenotation.atSignature(Denotations.scala:645)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readLengthTerm$1(TreeUnpickler.scala:1322)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readTerm(TreeUnpickler.scala:1394)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readLengthTerm$1(TreeUnpickler.scala:1233)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readTerm(TreeUnpickler.scala:1394)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.$anonfun$19(TreeUnpickler.scala:984)
	at dotty.tools.tasty.TastyReader.collectWhile(TastyReader.scala:137)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readTemplate(TreeUnpickler.scala:987)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readNewDef(TreeUnpickler.scala:905)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readIndexedDef(TreeUnpickler.scala:824)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$Completer.liftedTree1$1(TreeUnpickler.scala:138)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$Completer.complete(TreeUnpickler.scala:142)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:173)
	at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:187)
	at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:189)
	at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:187)
	at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:189)
	at dotty.tools.dotc.core.Types$NamedType.info(Types.scala:2302)
	at dotty.tools.dotc.core.Types$TypeRef.underlying(Types.scala:2839)
	at dotty.tools.dotc.core.Types$TypeProxy.superType(Types.scala:1990)
	at dotty.tools.dotc.core.Types$Type.findDecl(Types.scala:643)
	at dotty.tools.dotc.core.Types$Type.decl(Types.scala:628)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readLengthTerm$1(TreeUnpickler.scala:1322)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readTerm(TreeUnpickler.scala:1394)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readLengthTerm$1(TreeUnpickler.scala:1233)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readTerm(TreeUnpickler.scala:1394)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.$anonfun$19(TreeUnpickler.scala:984)
	at dotty.tools.tasty.TastyReader.collectWhile(TastyReader.scala:137)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readTemplate(TreeUnpickler.scala:987)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readNewDef(TreeUnpickler.scala:905)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$TreeReader.readIndexedDef(TreeUnpickler.scala:824)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$Completer.liftedTree1$1(TreeUnpickler.scala:138)
	at dotty.tools.dotc.core.tasty.TreeUnpickler$Completer.complete(TreeUnpickler.scala:142)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:173)
	at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:187)
	at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:189)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.parentSyms(SymDenotations.scala:1831)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.computeBaseData(SymDenotations.scala:1904)
	at dotty.tools.dotc.core.SymDenotations$BaseDataImpl.apply(SymDenotations.scala:2889)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseData(SymDenotations.scala:1883)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.baseClassSet(SymDenotations.scala:1899)
	at dotty.tools.dotc.core.SymDenotations$ClassDenotation.derivesFrom(SymDenotations.scala:1925)
	at dotty.tools.dotc.core.Types$Type.loop$1(Types.scala:268)
	at dotty.tools.dotc.core.Types$Type.derivesFrom(Types.scala:292)
	at dotty.tools.dotc.typer.Namer$ClassCompleter.checkedParentType$1(Namer.scala:1490)
	at dotty.tools.dotc.typer.Namer$ClassCompleter.$anonfun$27(Namer.scala:1558)
	at scala.collection.immutable.List.map(List.scala:246)
	at dotty.tools.dotc.typer.Namer$ClassCompleter.completeInCreationContext(Namer.scala:1558)
	at dotty.tools.dotc.typer.Namer$Completer.complete(Namer.scala:810)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.completeFrom(SymDenotations.scala:173)
	at dotty.tools.dotc.core.Denotations$Denotation.completeInfo$1(Denotations.scala:187)
	at dotty.tools.dotc.core.Denotations$Denotation.info(Denotations.scala:189)
	at dotty.tools.dotc.core.SymDenotations$SymDenotation.ensureCompleted(SymDenotations.scala:380)
	at dotty.tools.dotc.typer.Typer.retrieveSym(Typer.scala:2836)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2861)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2957)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3025)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3029)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3051)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3101)
	at dotty.tools.dotc.typer.Typer.typedBlockStats(Typer.scala:1063)
	at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1067)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2903)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2958)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3025)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3029)
	at dotty.tools.dotc.typer.Typer.typedNew(Typer.scala:814)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2899)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2958)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3025)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3029)
	at dotty.tools.dotc.typer.Typer.typedAssign(Typer.scala:1037)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2902)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2958)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3025)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3029)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3145)
	at dotty.tools.dotc.typer.Typer.typedBlock(Typer.scala:1069)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2903)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2958)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3025)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3029)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3145)
	at dotty.tools.dotc.typer.Typer.$anonfun$51(Typer.scala:2356)
	at dotty.tools.dotc.inlines.PrepareInlineable$.dropInlineIfError(PrepareInlineable.scala:249)
	at dotty.tools.dotc.typer.Typer.typedDefDef(Typer.scala:2356)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2871)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2957)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3025)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3029)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3051)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3101)
	at dotty.tools.dotc.typer.Typer.typedClassDef(Typer.scala:2532)
	at dotty.tools.dotc.typer.Typer.typedTypeOrClassDef$1(Typer.scala:2883)
	at dotty.tools.dotc.typer.Typer.typedNamed$1(Typer.scala:2887)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2957)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3025)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3029)
	at dotty.tools.dotc.typer.Typer.traverse$1(Typer.scala:3051)
	at dotty.tools.dotc.typer.Typer.typedStats(Typer.scala:3101)
	at dotty.tools.dotc.typer.Typer.typedPackageDef(Typer.scala:2659)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:2928)
	at dotty.tools.dotc.typer.Typer.typedUnadapted(Typer.scala:2958)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3025)
	at dotty.tools.dotc.typer.Typer.typed(Typer.scala:3029)
	at dotty.tools.dotc.typer.Typer.typedExpr(Typer.scala:3145)
	at dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$1(TyperPhase.scala:44)
	at dotty.tools.dotc.typer.TyperPhase.typeCheck$$anonfun$adapted$1(TyperPhase.scala:54)
	at scala.Function0.apply$mcV$sp(Function0.scala:42)
	at dotty.tools.dotc.core.Phases$Phase.monitor(Phases.scala:429)
	at dotty.tools.dotc.typer.TyperPhase.typeCheck(TyperPhase.scala:54)
	at dotty.tools.dotc.typer.TyperPhase.runOn$$anonfun$3(TyperPhase.scala:88)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.immutable.List.foreach(List.scala:333)
	at dotty.tools.dotc.typer.TyperPhase.runOn(TyperPhase.scala:88)
	at dotty.tools.dotc.Run.runPhases$1$$anonfun$1(Run.scala:238)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:15)
	at scala.runtime.function.JProcedure1.apply(JProcedure1.java:10)
	at scala.collection.ArrayOps$.foreach$extension(ArrayOps.scala:1321)
	at dotty.tools.dotc.Run.runPhases$1(Run.scala:249)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$1(Run.scala:257)
	at dotty.tools.dotc.Run.compileUnits$$anonfun$adapted$1(Run.scala:266)
	at dotty.tools.dotc.util.Stats$.maybeMonitored(Stats.scala:68)
	at dotty.tools.dotc.Run.compileUnits(Run.scala:266)
	at dotty.tools.dotc.Run.compileSources(Run.scala:190)
	at dotty.tools.dotc.Run.compile(Run.scala:174)
	at dotty.tools.dotc.Driver.doCompile(Driver.scala:35)
	at dotty.tools.xsbt.CompilerBridgeDriver.run(CompilerBridgeDriver.java:88)
	at dotty.tools.xsbt.CompilerBridge.run(CompilerBridge.java:22)
	at sbt.internal.inc.AnalyzingCompiler.compile(AnalyzingCompiler.scala:91)
	at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$7(MixedAnalyzingCompiler.scala:192)
	at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18)
	at sbt.internal.inc.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:247)
	at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4(MixedAnalyzingCompiler.scala:182)
	at sbt.internal.inc.MixedAnalyzingCompiler.$anonfun$compile$4$adapted(MixedAnalyzingCompiler.scala:163)
	at sbt.internal.inc.JarUtils$.withPreviousJar(JarUtils.scala:239)
	at sbt.internal.inc.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:163)
	at sbt.internal.inc.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:210)
	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1(IncrementalCompilerImpl.scala:528)
	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileInternal$1$adapted(IncrementalCompilerImpl.scala:528)
	at sbt.internal.inc.Incremental$.$anonfun$apply$5(Incremental.scala:177)
	at sbt.internal.inc.Incremental$.$anonfun$apply$5$adapted(Incremental.scala:175)
	at sbt.internal.inc.Incremental$$anon$2.run(Incremental.scala:461)
	at sbt.internal.inc.IncrementalCommon$CycleState.next(IncrementalCommon.scala:116)
	at sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:56)
	at sbt.internal.inc.IncrementalCommon$$anon$1.next(IncrementalCommon.scala:52)
	at sbt.internal.inc.IncrementalCommon.cycle(IncrementalCommon.scala:263)
	at sbt.internal.inc.Incremental$.$anonfun$incrementalCompile$8(Incremental.scala:416)
	at sbt.internal.inc.Incremental$.withClassfileManager(Incremental.scala:503)
	at sbt.internal.inc.Incremental$.incrementalCompile(Incremental.scala:403)
	at sbt.internal.inc.Incremental$.apply(Incremental.scala:169)
	at sbt.internal.inc.IncrementalCompilerImpl.compileInternal(IncrementalCompilerImpl.scala:528)
	at sbt.internal.inc.IncrementalCompilerImpl.$anonfun$compileIncrementally$1(IncrementalCompilerImpl.scala:482)
	at sbt.internal.inc.IncrementalCompilerImpl.handleCompilationError(IncrementalCompilerImpl.scala:332)
	at sbt.internal.inc.IncrementalCompilerImpl.compileIncrementally(IncrementalCompilerImpl.scala:420)
	at sbt.internal.inc.IncrementalCompilerImpl.compile(IncrementalCompilerImpl.scala:137)
	at org.gradle.api.internal.tasks.scala.ZincScalaCompiler.execute(ZincScalaCompiler.java:157)
	at org.gradle.api.internal.tasks.scala.ZincScalaCompilerFacade.execute(ZincScalaCompilerFacade.java:39)
	at org.gradle.api.internal.tasks.scala.ZincScalaCompilerFacade.execute(ZincScalaCompilerFacade.java:26)
	at org.gradle.api.internal.tasks.compile.daemon.AbstractIsolatedCompilerWorkerExecutor$CompilerWorkAction.execute(AbstractIsolatedCompilerWorkerExecutor.java:78)
	at org.gradle.workers.internal.DefaultWorkerServer.execute(DefaultWorkerServer.java:63)
	at org.gradle.workers.internal.AbstractClassLoaderWorker$1.create(AbstractClassLoaderWorker.java:49)
	at org.gradle.workers.internal.AbstractClassLoaderWorker$1.create(AbstractClassLoaderWorker.java:43)
	at org.gradle.internal.classloader.ClassLoaderUtils.executeInClassloader(ClassLoaderUtils.java:100)
	at org.gradle.workers.internal.AbstractClassLoaderWorker.executeInClassLoader(AbstractClassLoaderWorker.java:43)
	at org.gradle.workers.internal.IsolatedClassloaderWorker.run(IsolatedClassloaderWorker.java:49)
	at org.gradle.workers.internal.IsolatedClassloaderWorker.run(IsolatedClassloaderWorker.java:30)
	at org.gradle.workers.internal.WorkerDaemonServer.run(WorkerDaemonServer.java:87)
	at org.gradle.workers.internal.WorkerDaemonServer.run(WorkerDaemonServer.java:56)
	at org.gradle.process.internal.worker.request.WorkerAction$1.call(WorkerAction.java:138)
	at org.gradle.process.internal.worker.child.WorkerLogEventListener.withWorkerLoggingProtocol(WorkerLogEventListener.java:41)
	at org.gradle.process.internal.worker.request.WorkerAction.run(WorkerAction.java:135)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	at java.base/java.lang.reflect.Method.invoke(Method.java:578)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:36)
	at org.gradle.internal.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
	at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:182)
	at org.gradle.internal.remote.internal.hub.MessageHubBackedObjectConnection$DispatchWrapper.dispatch(MessageHubBackedObjectConnection.java:164)
	at org.gradle.internal.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:414)
	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:49)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1589)
no sig for TypeRef(ThisType(TypeRef(NoPrefix,module class stage)),class Window) because of ()

Error:scalac: No 'scala-library*.jar' in Scala compiler classpath in Scala SDK

I'm using Java 8
I have Scala 2.12.4
using Scalafx 8.0.144-R12
using IntelliJ 2017.3
sbt version 1.0.2

I'm getting error:
Error:scalac: No 'scala-library*.jar' in Scala compiler classpath in Scala SDK sbt: org.scala-lang:scala-library:2.12.4:jar
when I try to debug the scalafx-hello-world example

I can run it from the sbt shell and the UI will display

here's what my build.sbt looks like

image

Error running this on Mac

I was running this on mac, and I got this weird error. I have Java 8 and Scala 2.11.6.

➜  scalafx-hello-world-master  sbt run
[info] Loading project definition from /Users/Aimingnie/Desktop/ScalaSwing/scalafx-hello-world-master/project
[info] Set current project to ScalaFX Hello World (in build file:/Users/Aimingnie/Desktop/ScalaSwing/scalafx-hello-world-master/)
[info] Running hello.ScalaFXHelloWorld
[error] Exception in Application start method
[error] Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
[error]     at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:875)
[error]     at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$147(LauncherImpl.java:157)
[error]     at com.sun.javafx.application.LauncherImpl$$Lambda$1/423031029.run(Unknown Source)
[error]     at java.lang.Thread.run(Thread.java:745)
[error] Caused by: java.lang.NoClassDefFoundError: javafx/scene/chart/LineChart$SortingPolicy
[error]     at scalafx.Includes$.<init>(Includes.scala:58)
[error]     at scalafx.Includes$.<clinit>(Includes.scala)
[error]     at scalafx.stage.Stage.title(Stage.scala:107)
[error]     at scalafx.stage.Stage.title_$eq(Stage.scala:109)
[error]     at hello.ScalaFXHelloWorld$$anon$4.<init>(ScalaFXHelloWorld.scala:43)
[error]     at hello.ScalaFXHelloWorld$.delayedEndpoint$hello$ScalaFXHelloWorld$1(ScalaFXHelloWorld.scala:42)
[error]     at hello.ScalaFXHelloWorld$delayedInit$body.apply(ScalaFXHelloWorld.scala:40)
[error]     at scala.Function0$class.apply$mcV$sp(Function0.scala:40)
[error]     at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
[error]     at scalafx.application.JFXApp$$anonfun$init$1.apply(JFXApp.scala:250)
[error]     at scalafx.application.JFXApp$$anonfun$init$1.apply(JFXApp.scala:250)
[error]     at scala.collection.immutable.List.foreach(List.scala:381)
[error]     at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35)
[error]     at scala.collection.mutable.ListBuffer.foreach(ListBuffer.scala:45)
[error]     at scalafx.application.JFXApp$class.init(JFXApp.scala:250)
[error]     at hello.ScalaFXHelloWorld$.init(ScalaFXHelloWorld.scala:40)
[error]     at scalafx.application.AppHelper.start(AppHelper.scala:32)
[error]     at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$153(LauncherImpl.java:821)
[error]     at com.sun.javafx.application.LauncherImpl$$Lambda$51/1550442835.run(Unknown Source)
[error]     at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$166(PlatformImpl.java:323)
[error]     at com.sun.javafx.application.PlatformImpl$$Lambda$47/1532659705.run(Unknown Source)
[error]     at com.sun.javafx.application.PlatformImpl.lambda$null$164(PlatformImpl.java:292)
[error]     at com.sun.javafx.application.PlatformImpl$$Lambda$49/1161744034.run(Unknown Source)
[error]     at java.security.AccessController.doPrivileged(Native Method)
[error]     at com.sun.javafx.application.PlatformImpl.lambda$runLater$165(PlatformImpl.java:291)
[error]     at com.sun.javafx.application.PlatformImpl$$Lambda$48/529507459.run(Unknown Source)
[error]     at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
[error] Caused by: java.lang.ClassNotFoundException: javafx.scene.chart.LineChart$SortingPolicy
[error]     at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
[error]     at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
[error]     at java.security.AccessController.doPrivileged(Native Method)
[error]     at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
[error]     at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[error]     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
[error]     at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[error]     ... 27 more

fails to run on chromebook

I get runtime errors trying this on my chromebook using linux:
Cant load AMD 64 bit .so on AARCH64 bit platform

Are there plans to add arm64 support?

ClassNotFoundException in sbt run

Hi,

I have Java 8 installed and run into this issue:

git clone …
sbt run
[info] Running hello.ScalaFXHelloWorld 
[error] Exception in Application start method
[error] Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
[error]     at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:894)
[error]     at com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:56)
[error]     at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:158)
[error]     at java.lang.Thread.run(Thread.java:744)
[error] Caused by: java.lang.NoClassDefFoundError: javafx/scene/chart/LineChart$SortingPolicy
[error]     at scalafx.Includes$.<init>(Includes.scala:58)
[error]     at scalafx.Includes$.<clinit>(Includes.scala)
[error]     at scalafx.stage.Stage.title(Stage.scala:107)
[error]     at scalafx.stage.Stage.title_$eq(Stage.scala:109)
[error]     at hello.ScalaFXHelloWorld$$anon$4.<init>(ScalaFXHelloWorld.scala:43)
[error]     at hello.ScalaFXHelloWorld$.delayedEndpoint$hello$ScalaFXHelloWorld$1(ScalaFXHelloWorld.scala:42)
[error]     at hello.ScalaFXHelloWorld$delayedInit$body.apply(ScalaFXHelloWorld.scala:40)
[error]     at scala.Function0$class.apply$mcV$sp(Function0.scala:40)
[error]     at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
[error]     at scalafx.application.JFXApp$$anonfun$init$1.apply(JFXApp.scala:250)
[error]     at scalafx.application.JFXApp$$anonfun$init$1.apply(JFXApp.scala:250)
[error]     at scala.collection.immutable.List.foreach(List.scala:381)
[error]     at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35)
[error]     at scala.collection.mutable.ListBuffer.foreach(ListBuffer.scala:45)
[error]     at scalafx.application.JFXApp$class.init(JFXApp.scala:250)
[error]     at hello.ScalaFXHelloWorld$.init(ScalaFXHelloWorld.scala:40)
[error]     at scalafx.application.AppHelper.start(AppHelper.scala:32)
[error]     at com.sun.javafx.application.LauncherImpl$8.run(LauncherImpl.java:837)
[error]     at com.sun.javafx.application.PlatformImpl$7.run(PlatformImpl.java:335)
[error]     at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:301)
[error]     at com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:298)
[error]     at java.security.AccessController.doPrivileged(Native Method)
[error]     at com.sun.javafx.application.PlatformImpl$6.run(PlatformImpl.java:298)
[error]     at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
[error] Caused by: java.lang.ClassNotFoundException: javafx.scene.chart.LineChart$SortingPolicy
[error]     at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
[error]     at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
[error]     at java.security.AccessController.doPrivileged(Native Method)
[error]     at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
[error]     at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
[error]     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
[error]     at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[error]     ... 24 more

License

About https://github.com/scalafx/scalafx-hello-world/blob/master/LICENSE

The current license seems copied from ScalaFX project itself. Since this one is a template, intended to get people started using ScalaFX I would ask you to consider something like the MIT license, or simply putting the code in public domain. I believe this also is the actual intention by having such a template available.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.