You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ant (Apache Ant 1.7.1 wrapper, org.jnode.command.dev.ant.AntCommand) works for compiling Java and running code, but:
Ant's stdout does not stream over the serial console. Only Buildfile: build.xml (and occasionally part of the target list) appears; BUILD SUCCESSFUL, <echo> task messages, and program System.out are missing from serial output — even though the build actually succeeds and side effects happen.
<java fork="true"> throws a hard JVM-level NullPointerException and the task produces no output/side effect.
<java fork="false"> requires an explicit <classpath>, and additionally the target class must be public — a package-private class fails with IllegalAccessException from org.apache.tools.ant.taskdefs.ExecuteJava.
<javac srcdir="." destdir="."/> compiles fine, and other tasks such as <touch> work — so the issue is not that ant "does nothing", only that its console output is routed away from the serial console.
Repro (JNode all-plugins boot /full.jgz, serial agent console)
All files under /devices/hdb1/devtest/ant1 (JFAT).
1. Ant compile+run with a public class — output invisible over serial
Expected: [javac], [java], WH3_SYS_OUT, BUILD SUCCESSFUL, Total time. None appear — but wh3.txt is created (8 bytes WH3 RAN), proving the class ran. So ant output (streams) IS lost over serial; execution works.
2. fork="true" breaks
Same build root with fork="true":
Serial output:
Buildfile: build.xml
java.lang.NullPointerException: NPE at address 3CDFE8D6
No wh3.txt created, no class output — ExecuteJava crashes when forking.
Buildfile: build.xml
java.lang.IllegalAccessException: Class org.apache.tools.ant.taskdefs.ExecuteJava can not access a member of class WriteHello2 with modifiers "public static"
(The same class runs fine with the shell's java WriteHello2 from that directory, which uses JCClassLoader + reflection and accepts non-public classes.)
Observations / Analysis
Ant output and serial: only Buildfile: goes to the serial buffer. BUILD SUCCESSFUL, [echo], [javac], and program stdout are swallowed (buffered at the ant Project/BuildLogger level, presumably because the task's System.out uses a non-flushing buffered stream that is lost). This is the reason the common "ant does nothing" impression exists for serial usage.
WORKAROUND (for serial): ant reliably runs/compiles; verify by side effects (a file the code creates, ls -l timestamps, etc.), and keep target classes public. If you need direct stdout over the agent, use javac + java shell commands (see jnode-serial/jnode-java-coding skills) instead of ant.
This VM used this all-plugins image/JFAT /devices/hdb1/devtest and the automatic serial console (SerialConsolePlugin, UART2 /tmp/jnode.serialpipe).
Suggested fixes
Make the ant wrapper (or the AntCommand) brief flush the Project logger / redirect ant log through an output stream that the shell flushes, so [echo], [javac], BUILD SUCCESSFUL reach the serial console.
Fix ExecuteJava / forking path to avoid the fork=true NPE (possibly implement forking with a JNode-owned JVM invocation or document that fork is unsupported).
Summary
ant(Apache Ant 1.7.1 wrapper,org.jnode.command.dev.ant.AntCommand) works for compiling Java and running code, but:Buildfile: build.xml(and occasionally part of the target list) appears;BUILD SUCCESSFUL,<echo>task messages, and programSystem.outare missing from serial output — even though the build actually succeeds and side effects happen.<java fork="true">throws a hard JVM-levelNullPointerExceptionand the task produces no output/side effect.<java fork="false">requires an explicit<classpath>, and additionally the target class must bepublic— a package-private class fails withIllegalAccessExceptionfromorg.apache.tools.ant.taskdefs.ExecuteJava.<javac srcdir="." destdir="."/>compiles fine, and other tasks such as<touch>work — so the issue is not that ant "does nothing", only that its console output is routed away from the serial console.Repro (JNode all-plugins boot
/full.jgz, serial agent console)All files under
/devices/hdb1/devtest/ant1(JFAT).1. Ant compile+run with a
publicclass — output invisible over serialWH3.java:build.xml:Serial output:
Expected:
[javac],[java],WH3_SYS_OUT,BUILD SUCCESSFUL,Total time. None appear — butwh3.txtis created (8 bytesWH3 RAN), proving the class ran. So ant output (streams) IS lost over serial; execution works.2.
fork="true"breaksSame build root with
fork="true":Serial output:
No
wh3.txtcreated, no class output —ExecuteJavacrashes when forking.3. package-private class +
fork="false"WriteHello2(nopublicon the class), built with:Serial output:
(The same class runs fine with the shell's
java WriteHello2from that directory, which usesJCClassLoader+ reflection and accepts non-public classes.)Observations / Analysis
Buildfile:goes to the serial buffer.BUILD SUCCESSFUL,[echo],[javac], and program stdout are swallowed (buffered at the antProject/BuildLoggerlevel, presumably because the task'sSystem.outuses a non-flushing buffered stream that is lost). This is the reason the common "ant does nothing" impression exists for serial usage.ls -ltimestamps, etc.), and keep target classespublic. If you need direct stdout over the agent, usejavac+javashell commands (see jnode-serial/jnode-java-coding skills) instead of ant./devices/hdb1/devtestand the automatic serial console (SerialConsolePlugin, UART2/tmp/jnode.serialpipe).Suggested fixes
AntCommand) brief flush theProjectlogger / redirect ant log through an output stream that the shell flushes, so[echo],[javac],BUILD SUCCESSFULreach the serial console.ExecuteJava/ forking path to avoid thefork=trueNPE (possibly implement forking with a JNode-owned JVM invocation or document thatforkis unsupported).java.