zebulaon
Messages postés15Date d'inscriptionmercredi 15 janvier 2003StatutMembreDernière intervention19 février 2003
-
27 janv. 2003 à 12:37
zebulaon
Messages postés15Date d'inscriptionmercredi 15 janvier 2003StatutMembreDernière intervention19 février 2003
-
28 janv. 2003 à 10:46
Bonjour, je cherche à passer un parametre à mon prog java, lors du lancement je dois specifier en mode console, le nom du fichier qui sera traité par le prog!
EX: C:\ JAVA TOTO C:\Rep1\SSRep2\monfichier.dll
J'aimerai pouvoir l'integrer en dur ds le main....
Afin de lancer uniquement
C:\ JAVA TOTO
public class Toto{
public static void main(String[] args) {
new titi.tito(args);
}
}
JHelp
Messages postés261Date d'inscriptionjeudi 5 septembre 2002StatutMembreDernière intervention 6 octobre 200511 28 janv. 2003 à 08:13
Une solution :
public class Toto
{
public static void main(String[] args)
{
String[] tab=new String[2];
tab[0]=args[0];
if(args.length<2)
tab[1]="C:\Rep1\SSRep2\monfichier.dll";
else
tab[1]=args[1];
new titi.tito(tab);
}
}
zebulaon
Messages postés15Date d'inscriptionmercredi 15 janvier 2003StatutMembreDernière intervention19 février 2003 28 janv. 2003 à 10:46
-------------------------------
Réponse au message :
-------------------------------
Merci bcp pour ton aide, elle ressemble bcp à celle que j'ai finalement trouvé... Pour ceux & celles à qui cela peut aider voici une autre solution qui permet en plus d'avoir des parametres de traiments fichiers en dur, une possibilité de parametres consoles!
Merci encore Jhelp
public class Toto {
public static void main(String[] args) {
String [] tab = new String [args.length+3];
for (int i=0; i<args.length; i++)
tab[i]=args[i];
tab[args.length]="C:\Rep1\SSRep2\monfichier.dll";
tab[args.length+1]="C:\Rep1\SSRep2\monfichier2.dll";
tab[args.length+2]="C:\Rep1\SSRep2\monfichier3.dll";
for (int j=0; j<tab.length; j++)
System.out.println(tab[j]);
System.out.println("");
new titi.tito(tab);
}
}