<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="http://forum.ubuntu-fr.org/extern.php?action=feed&amp;tid=1160231&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Forum Ubuntu-fr.org / lancer Treetagger depuis un programme java]]></title>
		<link>http://forum.ubuntu-fr.org/viewtopic.php?id=1160231</link>
		<description><![CDATA[Les sujets les plus récents dans lancer Treetagger depuis un programme java.]]></description>
		<lastBuildDate>Wed, 09 Jan 2013 08:16:36 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Réponse à&#160;:  lancer Treetagger depuis un programme java]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12140661#p12140661</link>
			<description><![CDATA[<p>Je te remercie infiniment Claudius, tu m&#039;as beaucoup éclairée <img src="http://forum.ubuntu-fr.org/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></description>
			<author><![CDATA[dummy@example.com (lynda12)]]></author>
			<pubDate>Wed, 09 Jan 2013 08:16:36 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12140661#p12140661</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  lancer Treetagger depuis un programme java]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12133481#p12133481</link>
			<description><![CDATA[<p>Re lynda12,</p><p>- Ok pour <em>mon_script</em> (il faudra qu&#039;il soit impérativement exécutable, c&#039;est pourquoi je souhaitais avoir le résultat complet de la ligne de commande &quot;pwd ; ls -l mon_script ; cat mon_script&quot;)</p><p>- Le lancement de <em>mon_script</em> se fera par :</p><div class="codebox"><pre><code>mon_script &lt;password&gt; &lt;fichier_a_tagger&gt; &lt;fichier_resultat&gt;</code></pre></div><p>- S&#039;agissant de l&#039;appel d&#039;une commande avec argument depuis Java, ci-après un bout de code qui devrait te montrer qu&#039;il n&#039;a y a pas de différence notable entre WIndows et Linux - hormis les chemins d&#039;accès et le programme de lancement sous Windows : </p><div class="codebox"><pre><code>cmd</code></pre></div><p> qui devient sous Linux : </p><div class="codebox"><pre><code>bash -c</code></pre></div><p>Maintenant le petit bout de code :</p><div class="codebox"><pre><code>    public void launchScriptTest() {

        String os = System.getProperty(&quot;os.name&quot;);
        logger.info(&quot;launchScriptTest(): Starting under [&quot; + os + &quot;]...&quot;);

        try {
            String args[] = null;

            if (os.equals(&quot;Windows XP&quot;)) {
                String locArgs[] = { &quot;explorer.exe&quot;, &quot;C:\\Program Files&quot; };
                args = locArgs;
            }
            else {
                // Unix probably ;-)
                String locArgs[] = { &quot;bash&quot;, &quot;-c&quot;, &quot;clear&quot; };
                args = locArgs;
            }

            Runtime runtime = Runtime.getRuntime();
            final Process p = runtime.exec(args);

        } catch (Exception e) {
            logger.error(e.getMessage(), e);
        }

        logger.info(&quot;launchScriptTest(): Leaving&quot;);
    }</code></pre></div><p>Ce test consiste à lancer sous Windows XP la commande &#039; explorer.exe &quot;C:\Program Files&quot; &#039; et sous Linux la commande &#039;&#160; bash -c clear&#160; &#039; (effacement de l&#039;écran)</p><p>- Pour finir, la ligne pour Windows</p><div class="codebox"><pre><code>String cmd = new String(&quot;cmd /c C:\\TreeTagger\\bin\\tag-english.bat  C:\\workspace\\My_Work\\&quot;+path + &quot; C:\\workspace\\My_Work\\&quot; + pathResult);</code></pre></div><p>sera a remplacer pour Linux par (sous condition que <em>mon_script</em> soit dans le PATH de l&#039;environnement)</p><div class="codebox"><pre><code>String cmd = new String(&quot;bash -c \&quot;mon_script &lt;password&gt; &lt;fichier_a_tagger&gt; &lt;fichier_resultat&gt;\&quot;&quot;);</code></pre></div><br /><p>En espérant t&#039;avoir aidée, A+<br />-- <br />Claudius</p>]]></description>
			<author><![CDATA[dummy@example.com (claudius01)]]></author>
			<pubDate>Tue, 08 Jan 2013 16:43:06 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12133481#p12133481</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  lancer Treetagger depuis un programme java]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12132971#p12132971</link>
			<description><![CDATA[<p>Il m&#039;affiche tout simplement le script lui même. </p><p>Si j&#039;ai bien compris (je vous rappelle que je suis novice <img src="http://forum.ubuntu-fr.org/img/smilies/smile.png" width="15" height="15" alt="smile" />&#160; )&#160; les $i sont les paramètres (le password, le fichier à étiqueter et le fichier résultat) . mais je n&#039;ai pas compris comment les donner au script. <br />Pour être plus précise, voici ma fonction en java sous windows : </p><p><span style="color: #2a2261">public static void appel_treetagger (String path, String pathResult) {<br />&#160; &#160;&#160; String cmd = new String(&quot;cmd /c C:\\TreeTagger\\bin\\tag-english.bat&#160; C:\\workspace\\My_Work\\&quot;+path + &quot; C:\\workspace\\My_Work\\&quot; + pathResult);<br />&#160; &#160;&#160; Runtime r = Runtime.getRuntime();<br />&#160; &#160; &#160;try {<br />&#160; &#160; &#160; &#160;&#160; &#160;Process p = r.exec(cmd);<br />&#160; &#160; &#160; &#160;&#160; &#160;<br />&#160; &#160; &#160; &#160;&#160; &#160;try {<br />&#160; &#160; &#160; &#160; &#160; &#160; p.waitFor();<br />&#160; &#160; &#160; &#160; } catch (InterruptedException e) {<br />&#160; &#160; &#160; &#160; &#160; &#160; e.printStackTrace();<br />&#160; &#160; &#160; &#160; }<br />&#160; &#160; &#160; &#160; } catch (IOException e) {<br />&#160; &#160; &#160; &#160; &#160; &#160; e.printStackTrace();<br />&#160; &#160; &#160; &#160; }<br />&#160; &#160;} </span></p><br /><br /><br /><p>je cherche l&#039;équivalent de ça en linux, j&#039;ai la syntaxe du treetagger (mon premier post) mais comment l&#039;appeler à travers un shell , je bloque !! <img src="http://forum.ubuntu-fr.org/img/smilies/sad.png" width="15" height="15" alt="sad" /></p><p>merci encore</p>]]></description>
			<author><![CDATA[dummy@example.com (lynda12)]]></author>
			<pubDate>Tue, 08 Jan 2013 16:00:46 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12132971#p12132971</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  lancer Treetagger depuis un programme java]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12132731#p12132731</link>
			<description><![CDATA[<p>Appliquant les principes <em>la machine a toujours raison</em> et <em>étant comme St. Thomas...</em>, peux-tu lancer les 3 commandes suivantes en une seule ligne et dans le répertoire où se trouve ce script <em>mon_script</em> :</p><div class="codebox"><pre><code>pwd ; ls -l mon_script ; cat mon_script</code></pre></div><br /><p>Cordialement, A+<br />-- <br />Claudius</p>]]></description>
			<author><![CDATA[dummy@example.com (claudius01)]]></author>
			<pubDate>Tue, 08 Jan 2013 15:33:33 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12132731#p12132731</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  lancer Treetagger depuis un programme java]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12132441#p12132441</link>
			<description><![CDATA[<p>C&#039;est moi qui vous remercie pour votre&#160; aide. </p><p>En fait quand je fais un <br />&quot;chmod +x&#160; mon_script &quot;</p><p> j&#039;ai le message suivait&#160; &#160;: impossible d&#039;accéder à mon_script aucun fichier ou dossier de ce type! </p><p>pourtant je me suis bien placée dans le répertoire où il est situé!</p>]]></description>
			<author><![CDATA[dummy@example.com (lynda12)]]></author>
			<pubDate>Tue, 08 Jan 2013 15:05:26 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12132441#p12132441</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  lancer Treetagger depuis un programme java]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12132161#p12132161</link>
			<description><![CDATA[<p>Re lynda12,</p><p>On va tenter de savoir pourquoi cela ne fonctionne pas déjà via un terminal :<br />- Le fichier script a t-il été mis avec les droits d&#039;exécution (chmod +x &lt;nom_du_script&gt;) ?<br />- Si oui, comment est-il lancé (copie de la ligne de commande)<br />- Copie de la sortie écran du terminal avec l&#039;erreur éventuelle.</p><br /><p>Merci pour ta contribution ;-)<br />-- <br />Claudius</p>]]></description>
			<author><![CDATA[dummy@example.com (claudius01)]]></author>
			<pubDate>Tue, 08 Jan 2013 14:42:24 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12132161#p12132161</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  lancer Treetagger depuis un programme java]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12132011#p12132011</link>
			<description><![CDATA[<p>merci pr votre réponse, </p><p>j&#039;ai essayé d&#039;exécuter le script mais ça ne marche pas, ni quand je le lance depuis mon prgramme ni via un terminal&#160; <img src="http://forum.ubuntu-fr.org/img/smilies/sad.png" width="15" height="15" alt="sad" /></p>]]></description>
			<author><![CDATA[dummy@example.com (lynda12)]]></author>
			<pubDate>Tue, 08 Jan 2013 14:28:24 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12132011#p12132011</guid>
		</item>
		<item>
			<title><![CDATA[Réponse à&#160;:  lancer Treetagger depuis un programme java]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12129471#p12129471</link>
			<description><![CDATA[<p>Bonjour,</p><p>S&#039;il faut encapsuler ladite ligne de commande dans un script, sauf erreur de ma part, le code suivant devrait répondre au problème :</p><div class="codebox"><pre><code>#!/bin/bash

if [ $# -ge 3 ]; then
  echo $1 | sudo -S perl ./treetagger/cmd/tokenize.pl $2 | ./treetagger/bin/tree-tagger ./treetagger/lib/english.par -lemma -token -sgml $3
else
  echo &quot;Usage: $0 &lt;password&gt; &lt;fichier_a_tagger&gt; &lt;fichier_resultat&gt;&quot;
  exit 2
fi

exit 0</code></pre></div><br /><p>Cordialement, A+<br />-- <br />Claudius</p>]]></description>
			<author><![CDATA[dummy@example.com (claudius01)]]></author>
			<pubDate>Tue, 08 Jan 2013 10:32:29 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12129471#p12129471</guid>
		</item>
		<item>
			<title><![CDATA[lancer Treetagger depuis un programme java]]></title>
			<link>http://forum.ubuntu-fr.org/viewtopic.php?pid=12121311#p12121311</link>
			<description><![CDATA[<p>J&#039;ai besoin d&#039;écrire un shell pour exécuter une commande qui traite un fichier en entrée et me sort le résultat dans un autre fichier </p><p>Voici la commande telle que je l’exécute dans un terminal </p><p>sudo perl ./treetagger/cmd/tokenize.pl&#160; &#160; fichier_a_tagger |&#160; &#160; &#160;./treetagger/bin/tree-tagger&#160; &#160; &#160; &#160; &#160;./treetagger/lib/english.par -lemma -token -sgml&#160; &#160;fichier_resultat</p><p> Je dois exécuter cette commande dans un programme java, mais d’après mes recherches, il faut écrire un script contenant cette commande et l&#039;exécuter ensuite avec Runtime. </p><p>Je dois dire que je suis novice en linux et j&#039;ai des contraintes d’exécuter mon application dans cet environnement. Je me retrouve dans la difficulté d&#039;écrire ce shell&#160; surtout qu&#039;il y a des paramètres en entrée fichier_a_tagger et fichier_resultat.&#160; </p><p>Merci d&#039;avance&#160; pr votre aide</p>]]></description>
			<author><![CDATA[dummy@example.com (lynda12)]]></author>
			<pubDate>Mon, 07 Jan 2013 16:18:23 +0000</pubDate>
			<guid>http://forum.ubuntu-fr.org/viewtopic.php?pid=12121311#p12121311</guid>
		</item>
	</channel>
</rss>
