Bug 65075 - My program works well on my operating system. But when I test it on another system, sometimes the output Word file is not generated
Summary: My program works well on my operating system. But when I test it on another s...
Alias: None
Product: POI
Classification: Unclassified
Component: XWPF (show other bugs)
Version: 4.1.2-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2021-01-12 12:26 UTC by abed shams
Modified: 2021-01-23 13:11 UTC (History)
0 users

The libraries I used in the project (17.21 KB, image/png)
2021-01-12 12:26 UTC, abed shams

Note You need to log in before you can comment on or make changes to this bug.
Description abed shams 2021-01-12 12:26:28 UTC
Created attachment 37701 [details]
The libraries I used in the project

Hi friends I have a big problem I wrote a program in Java with javafx and apache poi and got the output file using launch4j. My program works well on my operating system. But when I test it on another system, sometimes the output Word file is not generated.

I noticed that when I send the information of a row from the table to the new controller and I want to create a Word file in the new controller, the Word file is not created. Of course, there is no problem in my system and it does not run on other systems. I used the try-catch command around the document created with apache poi and got the IllegalArgumentException error. My codes are as follows First we send the information of one of the rows of the table to the destination controller as below

    void onNewAmrieEnteghaliItemClick(ActionEvent event) {
            TablePosition pos = soldierTable.getSelectionModel().getSelectedCells().get(0);
            int row = pos.getRow();
            FXMLLoader loader = new FXMLLoader(getClass().getResource("GetAmrieEnteghal.fxml"));
            loader.setControllerFactory(new Callback<Class<?>, Object>() {
                public Object call(Class<?> controllerClass) {
                    if (controllerClass == GetAmrieEnteghalController.class) {
                        GetAmrieEnteghalController ctrl = new GetAmrieEnteghalController();
                        return ctrl ;
                    } else {
                        try {
                            return controllerClass.newInstance();
                        } catch (Exception exc) {
                            throw new RuntimeException(exc); // just bail
            Parent root = loader.load();
            Stage stage = new Stage();
            Scene scene = new Scene(root);

        }catch(Exception e){
In GetAmrieEnteghalController we give the selected row information to the database and receive other record information and then place it in the object created with apache poi as below

package javafxapplication3;

import com.jfoenix.controls.JFXTextField;
import java.net.URL;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.stage.Stage;
import javafxapplication3.Models.MyAlert;
import javafxapplication3.Reports.AmrieEnteghal;

public class GetAmrieEnteghalController implements Initializable {
    private String s_code_meli;
    public void setP(String code_meli){
        s_code_meli = code_meli;
    private JFXTextField be;

    private JFXTextField girande;
    private JFXTextField sh_nameh;

    private JFXTextField t_kasr_az_amar;

    void onGetFormBtnClick(ActionEvent event) {
        String daraje = null, name= null, pedar= null, t_ezam= null, sh_amrie= null, t_amrie= null, t_enteghal= null;
            if(SQLiteDB.selectQuery("select * from soldiers where code_meli = '"+s_code_meli+"';")){
                ResultSet res = SQLiteDB.getResultSet();
                try {
                        daraje = res.getString("daraje");
                        name = res.getString("name");
                        pedar = res.getString("pedar");
                        t_ezam = res.getString("t_e");
                        sh_amrie = res.getString("sh_amrie_enteghal");
                        t_amrie = res.getString("t_amrie_enteghal");
                        t_enteghal = res.getString("t_enteghal");
                } catch (SQLException ex) {
            AmrieEnteghal form = new AmrieEnteghal(daraje, name, pedar, s_code_meli, t_ezam, sh_nameh.getText(), be.getText(), girande.getText(), sh_amrie, t_amrie, t_enteghal, t_kasr_az_amar.getText());
        }catch(Exception e){
I put the AmrieEnteghal object in try-catch and got the following error on other systems with different offices
java.lang.illegalargumentexception file "docs/AmrieEnteghal.docx" does not exist
Where do you think the problem is? Please help me. Could there be a problem with jre? Please forgive me for poor English
Comment 1 Sayi 2021-01-15 02:12:48 UTC
I think you should focus on whether it's a POI bug, rather than giving too much irrelevant code.
Comment 2 Dominik Stadler 2021-01-23 13:11:47 UTC
As far as I can see this looks very much like some local problem. If it works on one machine and not on another it is very likely to be caused by some local difference in your environment.

If you can narrow down the problem to an actual problem with Apache POI, then please try to provide some way of properly reproducing the problem, i.e. a sample or test-case which can be executed without your application-specific code being involved and then reopen this bug with the additional information.