PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV Mobile 2024 → Error compiling procedure in java to save a BarCode image. Unreported exception
Error compiling procedure in java to save a BarCode image. Unreported exception
Débuté par Alramo, 27 juil. 2018 10:28 - 2 réponses
Posté le 27 juillet 2018 - 10:28
Hi,

I am trying to generate a bar code and save it in a file (jpg, png, ..) from WinDev Mobile 22. For this I am using a very simple procedure in java that (importing the library barbecue-1.5-beta1.jar), I compiles correctly when generating the apk.

The problem that I find is that when calling this procedure from a button on a form, when compiling, I get the following error:

  : compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
C: \ My Mobile Projects \ BerCodeGenerator \ Android \ Generation \ src \ com \ mycompany \ bercodegenerator \ wdgen \ GWDFWIN_NoName1.java: 143: error: unreported exception Exception; must be caught or declared to be thrown
vWD_sResult.setValeur (GWDCPCOL_GlobalProcedures.TestBarcode ());

I know little about Java programming, so if someone can help me identify the problem, I would appreciate it.

The Java code is the following:

import java.io.File;
import net.sourceforge.barbecue.Barcode;
import net.sourceforge.barbecue.BarcodeFactory;
import net.sourceforge.barbecue.BarcodeImageHandler;

public static String TestBarcode() throws Exception {

try {
Barcode barcode = BarcodeFactory.createCode39("70215000340", true);//BarcodeFactory.createCode39(text, checkSum);

File imgFile = new File("C:\testsize.png");

//Write the bar code to PNG file
BarcodeImageHandler.savePNG(barcode, imgFile);
return "1";

} catch (Exception e) {
e.printStackTrace();
return "0";
}
}
Posté le 27 juillet 2018 - 13:47
Hi

try this:

http://fabriceharari.com/UK/Page_Article.awp…

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Free Video Courses, free WXShowroom.com, open source WXReplication, open
source WXEDM.

More information on http://www.fabriceharari.com


On 7/27/2018 2:28 AM, Alramo wrote:
Hi,
I am trying to generate a bar code and save it in a file (jpg, png, ..)
from WinDev Mobile 22. For this I am using a very simple procedure in
java that (importing the library barbecue-1.5-beta1.jar), I compiles
correctly when generating the apk.

The problem that I find is that when calling this procedure from a
button on a form, when compiling, I get the following error:

  : compileDebugJavaWithJavac - is not incremental (e.g. outputs have
changed, no previous execution, etc.).
C: \ My Mobile Projects \ BerCodeGenerator \ Android \ Generation \ src
\ com \ mycompany \ bercodegenerator \ wdgen \ GWDFWIN_NoName1.java:
143: error: unreported exception Exception; must be caught or declared
to be thrown
vWD_sResult.setValeur (GWDCPCOL_GlobalProcedures.TestBarcode ());

I know little about Java programming, so if someone can help me identify
the problem, I would appreciate it.

The Java code is the following:

import java.io.File;
import net.sourceforge.barbecue.Barcode;
import net.sourceforge.barbecue.BarcodeFactory;
import net.sourceforge.barbecue.BarcodeImageHandler;

public static String TestBarcode()  throws Exception {

    try {
        Barcode barcode = BarcodeFactory.createCode39("70215000340",
true);//BarcodeFactory.createCode39(text, checkSum);

        File imgFile = new File("C:\testsize.png");

        //Write the bar code to PNG file
        BarcodeImageHandler.savePNG(barcode, imgFile);
        return "1";

    } catch (Exception e) {
        e.printStackTrace();
        return "0";
    }
}
Posté le 27 juillet 2018 - 18:37
Thanks Fabrice,

I have managed, with what you propose, to be able to compile and execute the application in the disositive, but when executing the java procedure, it shows me the following error:
  Failed Resolution Of: Lnet / sourceforge / barbecue / Barcode and I made the application, but this is another problem to solve!

regards