Pb de chemin d'acces en Java

largo41 Messages postés 4 Date d'inscription dimanche 10 avril 2005 Statut Membre Dernière intervention 15 juin 2005 - 15 juin 2005 à 16:26
JBAware Messages postés 174 Date d'inscription lundi 23 septembre 2002 Statut Membre Dernière intervention 6 avril 2011 - 15 juin 2005 à 22:18
Je suis tjs sur mon probleme pour ouvrir un fichier sur smartphone. J'ai maintenant une fonction qui doit marcher mais il persiste un pb sur le chemin d'acces du fichier.
Quelqun saurait comment ecrire un chemin d'acces (pour mes tests sous eclipse j'utilise un chemin d'acces pour mon disque W:)

try
{
javax.microedition.io.StreamConnection streamconnection = (javax.microedition.io.StreamConnection) javax.microedition.io.Connector.open("[file:///W:/Donnees/USERS/Pcamu/SolutionMobile/monfichier.txt file://W:/Donnees/USERS/Pcamu/SolutionMobile/monfichier.txt]", 1, true);
DataInputStream datainputstream = streamconnection.openDataInputStream();
int i = datainputstream.available();
if(i > 0)
{
byte abyte0[] = new byte[i];
datainputstream.read(abyte0);
String s1 = new String(abyte0);
nomSoc.append(s1,null);

} else
{
throw new Exception();
}
datainputstream.close();
streamconnection.close();
}
catch(Exception exception)
{
System.out.println("Open File Error: " + exception.toString());
display.setCurrent(new Alert("Error", "Unable to read", null, AlertType.ERROR));
}

3 réponses

sdailly Messages postés 5 Date d'inscription lundi 5 juillet 2004 Statut Membre Dernière intervention 6 juillet 2005
15 juin 2005 à 16:36
En mettant des // dans ton chemin à la place des /; cela fonctionne ?



peut etre /// à la place des //...



a voir.
0
largo41 Messages postés 4 Date d'inscription dimanche 10 avril 2005 Statut Membre Dernière intervention 15 juin 2005
15 juin 2005 à 16:46
Ca ne marche tjs pas meme en mettant des /// ou en
0
JBAware Messages postés 174 Date d'inscription lundi 23 septembre 2002 Statut Membre Dernière intervention 6 avril 2011 1
15 juin 2005 à 22:18
et des \ ???

JB@WAre
0
Rejoignez-nous