You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@netbeans.apache.org by Tom Eicher <te...@teicher.net> on 2023/11/14 09:35:05 UTC
run ant with different jdk
Hello,
so NB19 needs Java11+ to run, which is fine.
But (for now) I need to run my ant task with Java8,
but it seems ant is always launched within the JVM
that runs NB.
Testing, with Java8, on command line "ant dist" builds my ear,
whereas with Java11 I get errors like
cannot find symbol javax.annotation.Generated
which is probably expected.
Running in NB19, I get the very same error, and no setting I
found would change this behaviour.
Basically, I have the very same question like this one:
https://stackoverflow.com/questions/70036683/how-to-change-java-for-ant-in-netbeans
and none of the solutions works.
Any 5ct?
Thanks, Cheers, Tom.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
For additional commands, e-mail: users-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: run ant with different jdk
Posted by Martin Desruisseaux <ma...@geomatys.com>.
Le 2023-11-14 à 10 h 35, Tom Eicher a écrit :
> Testing, with Java8, on command line "ant dist" builds my ear,
> whereas with Java11 I get errors like cannot find symbol
> javax.annotation.Generated which is probably expected.
Alternatively, did you tried adding the `javax.annotation-api` JAR file
to the libs used by Ant [1]?
Martin
[1]https://stackoverflow.com/questions/48238014/how-can-be-solved-java-lang-noclassdeffounderror-javax-annotation-generated
Re: run ant with different jdk
Posted by Pieter van den Hombergh <pi...@gmail.com>.
Hello,
You might want to tweak which ant is used.
In the options>Java>Ant (first tab) you can set the ant home to any
directory you want.
You could adapt or wrap the ant script (depending on your OS), By setting
the JAVA_HOME environment variable to the jdk of your liking.
A strategy is to rename the ant script chosen by your OS (e.g. ant under
Linux or ant.cmd on Windows) to something like ant-orig[.cmd]
Then create a cmd or shell script with the contents (linux example shown)
-----
#!/bin/bash
ANT_HOME=.... (fill in)
export JAVA_HOME=... (fill in)
$ANT_HOME/bin/ant-orig "$@"
-----
Met vriendelijke groet,
Pieter van den Hombergh.
Kerboschstraat 12
5913 WH Venlo
On Tue, Nov 14, 2023 at 10:35 AM Tom Eicher <te...@teicher.net> wrote:
> Hello,
>
> so NB19 needs Java11+ to run, which is fine.
>
> But (for now) I need to run my ant task with Java8,
> but it seems ant is always launched within the JVM
> that runs NB.
>
> Testing, with Java8, on command line "ant dist" builds my ear,
> whereas with Java11 I get errors like
> cannot find symbol javax.annotation.Generated
> which is probably expected.
>
> Running in NB19, I get the very same error, and no setting I
> found would change this behaviour.
>
> Basically, I have the very same question like this one:
>
> https://stackoverflow.com/questions/70036683/how-to-change-java-for-ant-in-netbeans
> and none of the solutions works.
>
> Any 5ct?
>
> Thanks, Cheers, Tom.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: users-help@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>
>