I use a dll, programmed in c++, which has some outputs via cout or printf. In my Java Application I load this dll via JNA. Now I have both a Java Applet and a Java Web Start Application. For debugging (java programme ends as dll ends) I want to read the output from dll, but I don't get any output within java console. How can I get the output in java console, file, command line, where- and whatever? I'm sorry, but I'm not a c++ expert, more a newbie.
EDIT 1: Let me explain it in more detail and with an example:
The code for DLL file
PrintString.h
#include <windows.h>
#include <stdint.h>
using namespace std;
namespace JNATEST
{
class debugging
{
public:
static __declspec(dllexport) void getString();
};
}
PrintString.cpp
#include "stdafx.h"
#include <iostream>
#include "PrintString.h"
using namespace JNATEST;
using namespace std;
void debugging::getString()
{
cout << "test" << endl;
printf( "hello" );
}
Than the Java Code is the following: jna interface DLLMapping.java:
public interface DLLMapping extends Library{
public void getString();
}
main java programme:
public class JNATest{
static{
// load path to jna.library.path
System.setProperty("jna.library.path", (System.getProperty("java.io.tmpdir")));
// unzip dll to that path
.... (not important for that case)
}
public static void main(String[] args) {
DLLMapping clib = (DLLMapping)Native.loadLibrary("PrintString", DLLMapping.class);
clib.getString();
}
}
My problem is now, that everything works fine as far as I try it within eclipse. But when I use it as applet or jnlp, than I see that everything is loaded but I don't get any result to java console. My question is now why?
Thank you very much.