B4J Question Use external library with inline Java

Mr_fifty4

Member
Licensed User
Hi,

I need to write an app with support of ModbusTCP server and client. Before to rewrite the wheel (by coding protocol) i'm trying to use external library (easymodbusTCP) with inline java. I start with B4J example (InlineJava) adding part of library class. At first run compiler give me an error on import "gnu.io"

B4X:
#If JAVA
import java.io.IOException;
import java.net.*;
import java.nio.ByteBuffer;
import java.io.*;
import java.util.*;
import java.io.InputStream;
import java.io.OutputStream;
import gnu.io.CommPort;
import gnu.io.CommPortIdentifier;
import gnu.io.SerialPort;
…….

B4X:
src\b4j\example\class1.java:10: error: package gnu.io does not exist
import gnu.io.CommPort;
             ^
1 error
I found the package gnu.io as Java binary but this library isn't include in B4J editor (maybe not compatible with B4J).

Is there any way to use this gnu.io library in B4J?

thanks
 

DonManfred

Expert
Licensed User
Longtime User
I found the package gnu.io as Java binary
copy the jar to the aditional libs folder and add a ref to this jar (#additionaljar) in your project main class
 
Upvote 0
Top