1
votes

I have a problem when trying to display a MsExcel file in a JFrame. The exception is like this: com.jniwrapper.LibraryNotFoundException.

here is the code:

    public jexcelTest1() throws ExcelException{

        JFrame frame= new JFrame("Test application");
        frame.setDefaultCloseOperation
        (javax.swing.WindowConstants.EXIT_ON_CLOSE);
        Container cp = frame.getContentPane();
        cp.setLayout( new BorderLayout());
        JWorkbook workbook = new JWorkbook();
        cp.add(workbook);
        frame.setBounds(100, 100, 500, 500 );
        frame.setVisible(true);
    }

And the exception message is:

Exception in thread "main" com.jniwrapper.LibraryNotFoundException: Cannot find JNIWrapper native library (jniwrap.dll) in java.library.path: C:\Program Files\Java\jdk1.7.0_05\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Broadcom\Broadcom 802.11 Network Adapter\Driver;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\MiKTeX 2.9\miktex\bin\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files\Java\jre7\bin;.

I already added the following libraries: comfyj-2.8.jar, jexcel-1.5.jar, jniwrap-3.8.2.jar, slf4j-api-1.5.8.jar, slf4j-simple-1.5.8.jar, winpack-3.8.2.jar

Could you clarify this for me please. Thank you.

1
It says that it cannot find "jniwrap.dll", yet you don't mention having added the jniwrap.dll library. Can you try that first? - Michael Myers♦
Yes thank you Mr Myers. I tried it so I have palced it in the main jar file and finally this exception disapoeared ;) - Abdousoft

1 Answers

1
votes

You need to also add the DLL's (that come with TeamDev's API) either to the system path (I think system32) or, as prefer, add the DLL's directly to the default package of your applications Jar