On Tue Oct 18 18:07:05 2016, data...@gmail.com wrote:
> perl6 --target=jvm  --ll-exception --output=guess.jar guess.p6
> 
> 
> java.lang.NullPointerException
> 
>   in command_eval (gen/jvm/stage2/NQPHLL.nqp:1217)
> 
>   in command_eval (src/Perl6/Compiler.nqp:27)
> 
>   in command_line (gen/jvm/stage2/NQPHLL.nqp:1181)
> 
>   in MAIN (gen/jvm/main.nqp:47)
> 
>   in <mainline> (gen/jvm/main.nqp:38)
> 
>   in  (gen/jvm/main.nqp)
> 
> 
> 
> On Tue, Oct 18, 2016 at 4:43 PM, Elizabeth Mattijsen via RT <
> perl6-bugs-follo...@perl.org> wrote:
> 
> > What happens if you add --ll-exception to the command line?
> >
> > > On 18 Oct 2016, at 05:42, Felipe Valdes (via RT) <
> > perl6-bugs-follo...@perl.org> wrote:
> > >
> > > # New Ticket Created by  Felipe Valdes
> > > # Please include the string:  [perl #129909]
> > > # in the subject line of all future correspondence about this issue.
> > > # <URL: https://rt.perl.org/Ticket/Display.html?id=129909 >
> > >
> > >
> > > I want my clients to be able to run jar files
> > > generated by the perl6 command:
> > >
> > > The program:
> > >
> > > my $num = (1..100).pick;
> > >
> > > my $guess_count = 0;
> > >
> > >
> > > loop {
> > >
> > > my $guess = prompt("guess");
> > >
> > > if $guess == $num {
> > >
> > > say "Well done";
> > >
> > > last;
> > >
> > > }
> > >
> > > if $guess > $num {
> > >
> > > say "Lower";
> > >
> > > }
> > >
> > > if $guess < $num {
> > >
> > > say "Higher";
> > >
> > > }
> > >
> > > if $guess_count == 7 {
> > >
> > > say "you suck!";
> > >
> > > last;
> > >
> > > }
> > >
> > > $guess_count++;
> > >
> > > }
> > >
> > >
> > > the compilation command:
> > >
> > > perl6 --target=jvm --output=guess.jar guess.p6
> > >
> > >
> > > the result:
> > >
> > > ===SORRY!===
> > >
> > > java.lang.NullPointerException
> > >
> > >
> > > The version:
> > >
> > > This is Rakudo version 2016.10-9-g906719c built on JVM
> > >
> > > implementing Perl 6.c.
> > >
> > >
> > > I think the error message is less than awesome.
> > >
> > >
> > > Felipes-MacBook-Pro:backend2 a$ perl6 --stagestats --target=jvm
> > > --output=guess.jar guess.p6
> > >
> > > Stage start      :   0.000
> > >
> > > Stage parse      :   3.405
> > >
> > > Stage syntaxcheck:   0.001
> > >
> > > Stage ast        :   0.001
> > >
> > > Stage optimize   :   0.140
> > >
> > > Stage jast       :   0.395
> > >
> > > Stage classfile  :   0.081
> > >
> > > Stage jar        :   0.000
> > >
> > > Stage jvm        :   0.006
> > >
> > > ===SORRY!===
> > >
> > > java.lang.NullPointerException
> > >
> > > Felipes-MacBook-Pro:backend2 a$
> >
> >
> >

The feature you're asking for does not exist at the moment.

You can get the precompiled compilation unit of a Perl 6 program as a .jar with 
C<--target=jar>, but that doesn't help you, because it a compilation unit that 
can be understood by a Rakudo executable, not a jar file that can be understood 
by any JVM.

The file at [1] is a shell script that includes the step that will eventually 
be integrated into the perl6 binary to generate a self-contained jar file from 
Perl 6 code, albeit in the simplest way possible. That is, bundle the whole 
interpreter and make that run a predefined compilation unit. There is a 
corresponding Rakudo branch

Note though that the branch hasn't been updated in quite a while and might not 
necessarily merge cleanly against current HEAD.

[1] https://github.com/perl6/nqp/blob/standalone-jar/tools/jvm/one-jar-script.sh

Reply via email to