B4A Library [Tool] Simple Library Compiler - Build libraries without Eclipse

Status
Not open for further replies.

kiki78

Active Member
Licensed User
Longtime User
I can put them elsewhere.
Java code use String variable to found binaries.
For now, I extract binaries from assets of B4A app and I put it in File.DirInternal and this work.
But I don't found this really elegant. I expect to embed binaries in library.
My question is, if I embed binaries in wrapper library by putting it in "additional" path, how can I retrieve the path where it is extract at installation, if it is extract ?
If it is not automatically extract, is it possible to extract it ?
So sorry if my question is stupid
 

Erel

B4X founder
Staff member
Licensed User
Longtime User

kiki78

Active Member
Licensed User
Longtime User
Finally I not succeed to access embedded files with ClassLoader.
Instead I put my needed files in /additional/assets/ of my wrapper class, then I add and use BA.applicationContext.getAssets() to get it.
If this can help someone with similar problems...
 
Last edited:

tchart

Well-Known Member
Licensed User
Longtime User
Does anyone know how to capture the output from SLC from the command line?

Ive got a batch file at the moment like this;

@echo off

SET Lib_Name=LibraryName
SET Lib_Source_Dir="%CD%"
SET B4A_SLC=D:\Basic4android\SimpleLibraryCompiler\LibraryCompiler.exe

%B4A_SLC% %Lib_Name% %Lib_Source_Dir%

This outputs the tools output to the console but for the life of me I'm unable to redirect the SLC output to a log file.

Anybody know how to do this? I'd like to write the output to a log file and then scan for errors.
 

tchart

Well-Known Member
Licensed User
Longtime User
Thanks Erel but its not working. I'm pretty proficient in batch files but just cant figure this one out.

I've tried;

LibraryCompiler.exe MyLib E:\Java\MyLib > output.txt
LibraryCompiler.exe MyLib E:\Java\MyLib 1> output.txt
LibraryCompiler.exe MyLib E:\Java\MyLib 1> output1.txt 2> output2.txt

But nothing works.

Thanks
 

tchart

Well-Known Member
Licensed User
Longtime User
Ok, I will try and capture the return code. Thanks Erel
 

tchart

Well-Known Member
Licensed User
Longtime User
Thanks Erel, that works. I'll incorporate that into my script and share when Ive tested it.
 

tchart

Well-Known Member
Licensed User
Longtime User
All, thanks to Erel here is a modified batch file that I use to compile my libraries. I use Notepad++ to edit my libraries and then just run the batch file.

Instructions
  1. To get it to work create a new batch file in your library folder (the folder above the "src" folder).
  2. Copy the code below into your batch file.
  3. Edit the path to the Simple Library Compiler (ie update B4A_SLC variable).
  4. Update the Lib_Name variable with your library name.
  5. The library source will be picked up from the directory in which you placed the batch file. This is why placing the file in the correct directory is important.
  6. Run the batch file.
  7. If successful the batch file will terminate once complete.
  8. If an error occurs the batch file window will change colour (red/white) and stay visible for 60 seconds.
Hopefully this helps someone.

B4X:
@echo off

SET Lib_Name=LibraryName
SET Lib_Source_Dir="%CD%"
SET B4A_SLC=D:\Basic4android\SimpleLibraryCompiler\LibraryCompiler.exe

echo Library Name = %Lib_Name%
echo Library Source Directory = %Lib_Source_Dir%
echo B4A Library Compiler = %B4A_SLC%
echo.

REM ------------------------------------------
REM Compile library
REM ------------------------------------------
echo.

set errorlevel=
%B4A_SLC% %Lib_Name% %Lib_Source_Dir%

IF "%errorlevel%"=="0" GOTO OK
IF "%errorlevel%"=="1" GOTO ERRORS

:OK
GOTO EXIT

:ERRORS
color FC
echo.
echo ******************************************
echo There were compile errors!
echo ******************************************
timeout /t 60 /nobreak

GOTO EXIT

:EXIT
cls
echo.
echo Done!
echo.
 

mikeeepe

Member
Licensed User
Longtime User
Being new to Java, I am not sure how to use the SLC to wrap third-party JAR files. I want to use the attached jar file to access a Pervasive database but I am not sure how to generate the xml file needed to expose the functions. Any help would be greatly appreciated.

Thanks.
 

Attachments

  • pvjdbc2.jar
    165.6 KB · Views: 189

Luk

Member
Licensed User
Longtime User
Is it possible to add an option to SLC : -target 1.6 ? Or is there another way to tell the compiler to create 1.6 compatible java files ?
(I'm using java 1.8. )
Thanks.
 

Johan Schoeman

Expert
Licensed User
Longtime User
Hi Erel

Getting this error when I trying to compile a project with SLC. It compiled successfully yesterday but refuses to do so today. Cannot see any strange characters in the file at line 1. Any idea how to solve this?

java:1: illegal character: \65279
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…