public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Tony West <tonys-mailbox@hotmail.com>
To: Damien MATTEI <Damien.Mattei@unice.fr>,
	"kawa@sourceware.org"	<kawa@sourceware.org>
Subject: Re: Problem running Javafx hello world application
Date: Wed, 07 Jun 2017 20:51:00 -0000	[thread overview]
Message-ID: <SG2PR0401MB1982C6033FF2C90FD2DDE8B1E1C80@SG2PR0401MB1982.apcprd04.prod.outlook.com> (raw)
In-Reply-To: <201706071113.32872.Damien.Mattei@unice.fr>

Hi Damien,

I tried the change.

During compilation I received the following messages:

E:\Work\kawa>kawa --main -C hello-world.scm
Jun 08, 2017 6:46:08 AM org.jline.utils.Log logr
WARNING: Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)
(compiling hello-world.scm to org.kawa.javafx)
hello-world.scm:41:12: warning - void-valued expression where value is needed

When I attempted to run it, the same error messages as before appeared.

Tony
________________________________________
From: kawa-owner@sourceware.org <kawa-owner@sourceware.org> on behalf of Damien MATTEI <Damien.Mattei@unice.fr>
Sent: Wednesday, 7 June 2017 7:13 PM
To: kawa@sourceware.org
Subject: Re: Problem running Javafx hello world application

just for test, if you try this:
(define (main)
(let ((tst (invoke-static <org.kawa.javafx> 'launch)))
'())
)
does it change something?

i  think the probleme comes that you try to return a static object at the level (toplevel or REPL) of a java function,
if the main function is dynamically generated it can not return a static field, for incomatibility reason, i had such incompatibility problem in a pure java program.

Damien

Le Wednesday 07 June 2017 08:27:17 Tony West, vous avez écrit :
> Hi,
>
> Based on what I've seen in the mailing list, I've got the following simple Javafx application:
>
> (module-name <org.kawa.javafx>)
> (module-extends <javafx.application.Application>)
> (module-export start create-button)
> (module-compile-options main: #t)
>
> ;;
> ;;; Application
> ;;
>
> (define (start (primary-stage :: <javafx.stage.Stage>)) :: <void>
>   (invoke primary-stage 'setTitle "Hello World!")
>   (let ((root-pane (<javafx.scene.layout.StackPane>))
>         (button (create-button
>                  text: "Say 'Hello World'"
>                  event-handler: (lambda (event) (format #t "Hello World!")))))
>     (invoke (invoke root-pane 'getChildren) 'add button)
>     (invoke primary-stage 'setScene (<javafx.scene.Scene> root-pane 300 250))
>     (invoke primary-stage 'show)))
>
> ;;
> ;;; Utilities
> ;;
>
> (define (create-button #!key (text #f) (event-handler #f)) :: <javafx.scene.control.Button>
>   (let ((button :: <javafx.scene.control.Button> (<javafx.scene.control.Button>)))
>     (when text
>       (invoke button 'setText text))
>
>     (when event-handler
>       (invoke button 'setOnAction (object (<javafx.event.EventHandler>)
>                                     ((handle (event :: <javafx.event.ActionEvent>))
>                                       (event-handler event)))))
>
>     button))
>
>
> ;;
> ;;; Main
> ;;
>
> (define (main)
>   (invoke-static <org.kawa.javafx> 'launch))
>
> (main)
>
> When compiling I get the following:
>
> E:\Work\kawa>kawa --main -C hello-world.scm
> Jun 07, 2017 4:16:42 PM org.jline.utils.Log logr
> WARNING: Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)
> (compiling hello-world.scm to org.kawa.javafx)
>
> And when I run it I get the following:
>
> E:\Work\kawa>java org.kawa.javafx
> java.lang.reflect.InvocationTargetException
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
>         at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>         at java.lang.reflect.Method.invoke(Unknown Source)
>         at sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)
> Caused by: java.lang.IncompatibleClassChangeError: Expected static field org.kawa.javafx$frame.$main
>         at org.kawa.javafx.main(hello-world.scm)
>         ... 11 more
> Exception running application org.kawa.javafx
>
> I would be really grateful if someone could point out what I am doing wrong.
>
> Thanks.
>
> Tony
>
>


  reply	other threads:[~2017-06-07 20:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-07  6:27 Tony West
2017-06-07  9:13 ` Damien MATTEI
2017-06-07 20:51   ` Tony West [this message]
2017-06-07 21:21 ` Per Bothner
     [not found]   ` <SG2PR0401MB1982C9DBD03FC99CC1F0152DE1C90@SG2PR0401MB1982.apcprd04.prod.outlook.com>
2017-06-08 14:13     ` Per Bothner
2017-06-09  7:29       ` Tony West

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SG2PR0401MB1982C6033FF2C90FD2DDE8B1E1C80@SG2PR0401MB1982.apcprd04.prod.outlook.com \
    --to=tonys-mailbox@hotmail.com \
    --cc=Damien.Mattei@unice.fr \
    --cc=kawa@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).