Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

jni => dll problem!!!

Empfohlene Antworten

Veröffentlicht

hallo, ich probiere hier seit gestern mal so bissl rum und wollte was mit jni machen. gibt's ja ca. 1000 sachen im netzt drüber, die alle eigentlich gleich aussehen, das gleiche machen und gleich gut funktionieren. nur bei mir eben nicht!!!

ich habe eine doofe java-klasse:


public class Starter {

static{
System.out.println("nun lädt er dll....");
Runtime.getRuntime().loadLibrary("BigDll");
}

//diese Methode is in der DLL
private native void DoDo();

public static void main(String[] args) {
try{
System.out.println("Das ist java...");
Starter starter = new Starter();
starter.DoDo();
System.out.println("ENDE!");
}
catch(UnsatisfiedLinkError ex){
ex.printStackTrace();
System.out.println("Message: "+ex.getMessage());
System.out.println("CRASHBOOMBANG!!!");
}
}
}
[/php]

dann nehem ich das tolle javah-tool und mache da ne .h draus. faul ist der mensch!

*blitzerfunkel* eine schöne .h datei!

[php]
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class Starter */

#ifndef _Included_Starter
#define _Included_Starter
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: Starter
* Method: DoDo
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_Starter_DoDo
(JNIEnv *, jobject);

#ifdef __cplusplus
}
#endif
#endif

dann noch schnell in vc7 (ich benutze visual studio 2003), ein neues projekt anlegen, dll anklicken, eine cpp dazu basteln:


#include <jni.h>

class Starter{

JNIEXPORT void JNICALL Java_Starter_DoDo
(JNIEnv *, jobject)
{
printf("Das ist ne Ausgabe");
}
};
[/php]

compilieren.....

in das verzeichnis von java-main schieben....

java-programm ausführen und immer den fehler:

nun lädt er dll....

Das ist java...

java.lang.UnsatisfiedLinkError: DoDo

at Starter.DoDo(Native Method)

at Starter.main(Starter.java:27)

Message: DoDo

CRASHBOOMBANG!!!

erhalten....

ich weiß echt nicht mehr weiter. hab schon auf 100 verschiedene art und weisen dll erstellt und sonst was alles gemacht. ich schnalls einfach nicht. wenn mich einer erlösen möchte, dann bitte.... :)

bigredeyes

p.s. java 1.4.2, visual studio 2003

hm..... hab jetzt mal mit dev-c++ ne explizite c-dll gemacht. nun hat er keine probleme mehr! FUNKTIONIERT. aber wieso keine c++???????

bigredeyes

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.