IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Entrée/Sortie Java Discussion :

[JNI] Applet Loadlibray : acces denied


Sujet :

Entrée/Sortie Java

  1. #1
    Membre du Club

    Inscrit en
    Août 2002
    Messages
    36
    Détails du profil
    Informations forums :
    Inscription : Août 2002
    Messages : 36
    Points : 54
    Points
    54
    Par défaut [JNI] Applet Loadlibray : acces denied
    bonjour,

    j'ai crée un classe socket appelant des fonctions native pour acceder un C

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
     
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import java.applet.*;
    import java.applet.Applet;
    import javax.swing.*;
    import java.awt.Toolkit;
     
    public class Socket2 implements Runnable
    {
    	Thread tr = null ;
    	JavaVersC pSocket = null ;
     
    	public class JavaVersC
    	{
    	    public native long OpenTxSocket(	int iProtocol, 
    											String IpAddress, 
    											int iPortIp, 
    											int iTTL, 
    											String szIpAddressToBind, 
    											int iPortToBind);
     
    		public native boolean CloseTXSocket(long SockTX);
     
    		public native boolean SendTXSocket(	long SockTX, 
    										String Buffer);
     
    		public native long OpenRxSocket (	int iProtocol, 
    											String szIpAddress, 
    											int iPortToBind, 
    											String szIpAddressToBind, 
    											int iPortIp);
     
    		public native boolean CloseRXSocket(long SockRX);
     
    		public native String ReceiveRXSocket(long SockRX);
     
    		public native String SyncReceiveRXSocket(	long SockRX, 
    													int iTimeOut);
     
    	    public native String SendAndSyncReceive(	long SockTX, 
    													String szSend, 
    													long SockRX, 
    													int iTimeOut);
     
    		public native boolean SendAndSyncReceiveWithCallBack(	long SockTX, 
    																String szSend, 
    																long SockRX, 
    																int iTimeOut,
    																String Name, 
    																String Type);
     
    	    public void CallbackSocket(String Buffer)
    	    {
    			System.out.println("CallbackSocket IN\r\n");
     
    			System.out.println("CallbackSocket : " + Buffer);
    			System.out.println("\r\n");
    		}
     
    		public JavaVersC()
    		{
    			System.loadLibrary("JavaVersC"); 
    			//System.load("w:/java/JavaVersC.dll");
    		}
    	}
     
    	public Socket2() 
    	{
    		System.out.println(" Socket Constructeur\r\n ");
     
    		if (pSocket == null)
    		{
    			pSocket = new JavaVersC();
     
    			if (pSocket != null)
    			{
    				System.out.println(" Socket OK\r\n ");
    			}
    			else
    			{
    				System.out.println(" Socket Failed\r\n ");
    			}
    		}
     
    		if (tr == null) 
    		{
    			tr = new Thread(this);
    			tr.start();
    		}
    	}
     
    	public static void main(String args[])
    	{
    		System.out.println(" Socket main\r\n ");
    		new Socket2();
    	}
     
    	public void run()
    	{
    		System.out.println(" Socket run\r\n ");
     
    		while (true) 
    		{
     
    			try 
    			{ 
    				System.out.println(" Socket run\r\n ");
    				Thread.sleep(1000);
    			} 
    			catch(InterruptedException e)
    			{
    			}
    		}
    	}
     
    	public void init() 
    	{
    		System.out.println(" Socket init\r\n ");
    	}
    }
    compliation
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    javac Socket2.java
    Lancement

    Pour cette classe, lancer en ligne en console, le chargement de la dll se fait bien
    Mais je voudrais l'utiliser dans un applet afin d'interagir avec une page web
    j'ai voulus faire :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
     
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import java.applet.*;
    import java.applet.Applet;
    import javax.swing.*;
    import java.awt.Toolkit;
     
    public class Socket extends Applet implements Runnable
    {
    	Thread tr = null ;
    	JavaVersC pSocket = null ;
     
    	public class JavaVersC
    	{
    	    public native long OpenTxSocket(	int iProtocol, 
    											String IpAddress, 
    											int iPortIp, 
    											int iTTL, 
    											String szIpAddressToBind, 
    											int iPortToBind);
     
    		public native boolean CloseTXSocket(long SockTX);
     
    		public native boolean SendTXSocket(	long SockTX, 
    										String Buffer);
     
    		public native long OpenRxSocket (	int iProtocol, 
    											String szIpAddress, 
    											int iPortToBind, 
    											String szIpAddressToBind, 
    											int iPortIp);
     
    		public native boolean CloseRXSocket(long SockRX);
     
    		public native String ReceiveRXSocket(long SockRX);
     
    		public native String SyncReceiveRXSocket(	long SockRX, 
    													int iTimeOut);
     
    	    public native String SendAndSyncReceive(	long SockTX, 
    													String szSend, 
    													long SockRX, 
    													int iTimeOut);
     
    		public native boolean SendAndSyncReceiveWithCallBack(	long SockTX, 
    																String szSend, 
    																long SockRX, 
    																int iTimeOut,
    																String Name, 
    																String Type);
     
    	    public void CallbackSocket(String Buffer)
    	    {
    			System.out.println("CallbackSocket IN\r\n");
     
    			System.out.println("CallbackSocket : " + Buffer);
    			System.out.println("\r\n");
    		}
     
    		public JavaVersC()
    		{
    			System.loadLibrary("JavaVersC"); 
    		}
    	}
     
    	public Socket() 
    	{
    		System.out.println(" Socket Constructeur\r\n ");
    	}
     
    	public void main(String args[])
    	{
    		System.out.println(" Socket main\r\n ");
    		new Socket();
    	}
     
    	public void run()
    	{
    		System.out.println(" Socket run\r\n ");
     
    		while (true) 
    		{
    			try 
    			{ 
    				repaint();
    				System.out.println(" Socket run\r\n ");
    				Thread.sleep(1000);
    			} 
    			catch(InterruptedException e)
    			{
    			}
    		}
    	}
     
    	public void init() 
    	{
    		System.out.println(" Socket init\r\n ");
     
    		Dimension dim = getSize();
    		setBackground(Color.white); 
     
    		if (pSocket == null)
    		{
    			pSocket = new JavaVersC();
     
    			if (pSocket != null)
    			{
    				System.out.println(" Socket OK\r\n ");
    			}
    			else
    			{
    				System.out.println(" Socket Failed\r\n ");
    			}
    		}
     
    		if (tr == null) 
    		{
    			tr = new Thread(this);
    			tr.start();
    		}
    	}
    }
    compliation
    Lancement
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    appletviewer.exe Socket.html
    Mais cette dernier ne fonctionne pas "acces denied"
    que la dll soit dans le rep courant, dans system32 , çà fonctionne pas.


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
     
    <html>
    <head>
    <title>
    Page de test HTML
    </title>
    </head>
    <body>
    <center>
    Horloge appara&icirc;tra ci-dessous dans un navigateur Java.<br><br><br>
    <applet code= "Socket.class" name="MyAppletTest" width="125" height="125">
    Votre navigateur n'est pas compatible java.
    </applet>
    </center>
    </body>
    </html>
    j'ai essaye de faire un jar

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    jar cvfm Socket.jar Manifest.txt *.class JavaVersC.dll
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
     
    <html>
    <head>
    <title>
    Page de test HTML
    </title>
    </head>
    <body>
    <center>
    Horloge appara&icirc;tra ci-dessous dans un navigateur Java.<br><br><br>
    <applet code= "Socket.class" archive = "Socket.jar" name="MyAppletTest" width="125" height="125">
    Votre navigateur n'est pas compatible java.
    </applet>
    </center>
    </body>
    </html>
    çà fonctionne toujours pas

    Quelqu'un pourrait-il m'aider ?

    Merci

    @+

  2. #2
    Membre du Club

    Inscrit en
    Août 2002
    Messages
    36
    Détails du profil
    Informations forums :
    Inscription : Août 2002
    Messages : 36
    Points : 54
    Points
    54
    Par défaut
    re,
    j'ai enfin trouvé la solution.
    le loadlibrary etait mal placé et mal ecrit
    @+

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. applet avec acces SQL sécurisé ou pas ?
    Par alain57 dans le forum JDBC
    Réponses: 2
    Dernier message: 06/02/2007, 11h24
  2. [ERREUR MySQL] Acces denied
    Par Alexlesilex dans le forum Requêtes
    Réponses: 5
    Dernier message: 15/05/2006, 14h33
  3. ORA_29289 : directry acces denied
    Par genio dans le forum Oracle
    Réponses: 5
    Dernier message: 12/04/2006, 10h46
  4. Réponses: 4
    Dernier message: 12/01/2006, 02h45
  5. [Applet][Security] Access Denied
    Par medba dans le forum Applets
    Réponses: 3
    Dernier message: 23/09/2005, 14h40

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo