swChef Active Member Licensed User Longtime User Aug 4, 2021 #1 ref: B4X: Copy #CustomBuildAction: folders ready, %JAVABIN%\java.exe, -jar C:\Users\H\Downloads\compiletime.jar I would like to use an environment variable or IDE construct to access the compiletime.jar in the CustomBuildAction, so the same exact CBA line can be in any project on any computer I use despite installation/setup path differences. Is there a mechanism to reference the IDE SharedFiles path in a CBA that isn't an absolute or relative path, that the IDE supports? I'd rather not implement my own environment variable, or pop it into JAVABIN. B4X: Copy #CustomBuildAction: folders ready, %JAVABIN%\java.exe, -jar %Shared+Files%\Utils\compiletime.jar or similar.
ref: B4X: Copy #CustomBuildAction: folders ready, %JAVABIN%\java.exe, -jar C:\Users\H\Downloads\compiletime.jar I would like to use an environment variable or IDE construct to access the compiletime.jar in the CustomBuildAction, so the same exact CBA line can be in any project on any computer I use despite installation/setup path differences. Is there a mechanism to reference the IDE SharedFiles path in a CBA that isn't an absolute or relative path, that the IDE supports? I'd rather not implement my own environment variable, or pop it into JAVABIN. B4X: Copy #CustomBuildAction: folders ready, %JAVABIN%\java.exe, -jar %Shared+Files%\Utils\compiletime.jar or similar.
swChef Active Member Licensed User Longtime User Aug 4, 2021 #2 The following does not work. B4X: Copy #CustomBuildAction: 2, %JAVABIN%\java.exe, -jar %JAVABIN%\compiletime.jar Error: Unable to access jarfile %JAVABIN%\compiletime.jar Also tried running B4A as administrator. Also tried B4X: Copy #CustomBuildAction: 2, %JAVABIN%\java.exe, -jar %JAVABIN%\..\..\IDEJars\compiletime.jar Last edited: Aug 4, 2021
The following does not work. B4X: Copy #CustomBuildAction: 2, %JAVABIN%\java.exe, -jar %JAVABIN%\compiletime.jar Error: Unable to access jarfile %JAVABIN%\compiletime.jar Also tried running B4A as administrator. Also tried B4X: Copy #CustomBuildAction: 2, %JAVABIN%\java.exe, -jar %JAVABIN%\..\..\IDEJars\compiletime.jar
Erel B4X founder Staff member Licensed User Longtime User Aug 5, 2021 #3 Put the jar in the additional libraries folder and use %ADDITIONAL%
swChef Active Member Licensed User Longtime User Aug 5, 2021 #4 Thanks. Given that, I found these, which list more %% vars. https://www.b4x.com/android/forum/threads/b4x-comment-links.119897/ https://www.b4x.com/android/forum/threads/comment-links-with-date-and-time.132262/#post-834861 However when I tried %ADDITIONAL% B4X: Copy #CustomBuildAction: 2, %JAVABIN%\java.exe, -jar %ADDITIONAL%\compiletime.jar The compiler fails with B4X: Copy Running custom action. Error Error: Unable to access jarfile %ADDITIONAL%\compiletime.jar If I swap in the full path, it does work. Going back to -jar %ADDITIONAL%\compiletime.jar; if I put the jar in the B4A subfolder of the additional libraries folder, it still errors. Checking file properties on the jar there is a security notice, which I unblocked, but still doesn't work. I also tried %B4X%, same error. B4X: Copy -jar %B4X%\compiletime.jar And even %PROJECT% gives the same error. It would seem the environment variables do not work in that CBA parameter location, or I need more help. Only filesystem paths are working, including absolute and relative paths. The following does work, with the jar in the project folder, as does the full path. B4X: Copy -jar ..\compiletime.jar Using B4A 10.70.
Thanks. Given that, I found these, which list more %% vars. https://www.b4x.com/android/forum/threads/b4x-comment-links.119897/ https://www.b4x.com/android/forum/threads/comment-links-with-date-and-time.132262/#post-834861 However when I tried %ADDITIONAL% B4X: Copy #CustomBuildAction: 2, %JAVABIN%\java.exe, -jar %ADDITIONAL%\compiletime.jar The compiler fails with B4X: Copy Running custom action. Error Error: Unable to access jarfile %ADDITIONAL%\compiletime.jar If I swap in the full path, it does work. Going back to -jar %ADDITIONAL%\compiletime.jar; if I put the jar in the B4A subfolder of the additional libraries folder, it still errors. Checking file properties on the jar there is a security notice, which I unblocked, but still doesn't work. I also tried %B4X%, same error. B4X: Copy -jar %B4X%\compiletime.jar And even %PROJECT% gives the same error. It would seem the environment variables do not work in that CBA parameter location, or I need more help. Only filesystem paths are working, including absolute and relative paths. The following does work, with the jar in the project folder, as does the full path. B4X: Copy -jar ..\compiletime.jar Using B4A 10.70.
Erel B4X founder Staff member Licensed User Longtime User Aug 6, 2021 #5 1. First step is to upgrade to latest version of B4A. 2. The correct way to run jars is: Code: Copy #CustomBuildAction: folders ready, %ADDITIONAL%\compiletime.jar, This way it will work with all versions of Java.
1. First step is to upgrade to latest version of B4A. 2. The correct way to run jars is: Code: Copy #CustomBuildAction: folders ready, %ADDITIONAL%\compiletime.jar, This way it will work with all versions of Java.