Runtime.exec() with language specific chars (umlauts)

Hello,
my problem is as follows:
I need to run the glimpse search engine from a java application on solaris using JRE 1.3.1 with a search pattern containing special characters.
Glimpse has indexed UTF8 coded XML files that can contain text with language specific characters in different languages (i.e. german umlauts, spanish, chinese). The following code works fine on windows and with JRE 1.2.2 on solaris too:
String sSearchedFreeText = "Tür";
String sEncoding = "UTF8";
// Convert UTF8 search free text
ByteArrayOutputStream osByteArray = new ByteArrayOutputStream();
Writer w = new OutputStreamWriter(osByteArray, sEncoding);
w.write(sSearchedFreeText);
w.close();
// Generate process
String commandString = "glimpse -y -l -i -H /data/glimpseindex -W -L 20 {" + osByteArray.toString() + "}";
Process p = Runtime.getRuntime().exec(commandString);
One of the XML files contains:
<group topic="service-num">
<entry name="id">7059</entry>
<entry name="name">T&#195;&#188;rverkleidung</entry>
</group>
Running the java code with JRE 1.2.2 on solaris i get following correct commandline
glimpse -y -l -i -H /data/glimpseindex -W -L 20 {T&#195;&#188;rverkleidung}
--> glimpse finds correct filenames
Running it with JRE 1.3.1 i get following incorrect commandline
glimpse -y -l -i -H /data/glimpseindex -W -L 20 {T??rverkleidung}
--> glimpse finds nothing
JRE 1.2.2 uses as default charset ISO-8859-1 but JRE 1.3.1 uses ASCII on solaris.
Is it possible to change the default charset for the JVM in solaris environment?
Or is there a way to force encoding used by Runtime.exec() with java code?
Thanks in advance for any hints.
Karsten

osByteArray.toString()Yes, there's a way to force the encoding. You provide it as a parameter to the toString() method.

Similar Messages

  • Runtime.exec() with .bat-files in a jar

    Hi All,
    I've written a java-Program, which calls .bat-files per Runtime.exec() for some OS-specific tasks.
    Everything works fine, but if I want to pack the whole code and the .bat-files into several jars, I can't get the bat-files to run. I have tried to get it to work with "getClass().getResource()" as I do the same for my Images, and the returned URL seems to be OK so far (something like jar:file:/c:/test.jar! testpkg/test.bat). I converted this URL into a String and tried to run Runtime.exec() with it, but I always get a Runtime-Exception.
    The String looks exactly like the URL, when I print them to console.
    These bat-files are essential for the application and I would not try to pack them into a jar if I hadn't to distribute this application as a signed applet to unknown users, too.
    I hope there is anyone out there who can tell me if and how it is possible to run an external program out of java, which is packed into a jar, so thanx in advance to any helpful replies.
    acdeka

    You can't run the .bats simply because the shell can't access it. You tell it to run a file that simply doesn't exist in the OS.

  • Issue with language specific characters combined with AD-Logon to BO platform and client tools

    We are using SSO via Win AD to logon to BO-Launchpad. Generally this is working which means for Launch Pad no manual log on is needed. But  this is not working for users which have language specific letters in their AD name (e.g. öäüéèê...).
    What we have tried up to now:
    If the AD-User name is Test-BÖ the log on is working with the user name Test-BO with logon type AD
    If the logon Type "SAP" is used than it is possible to use the name Test-BÖ as the username
    Generally it is no problem in AD to use language specific letters (which means it is possible to e.g. log on to Windows with the user Test-BÖ)
    It is possible to read out the AD attributes from BO side and add them to the user. Which means in the user attributes the AD name Test-BÖ is shown via automatic import from AD. So it's not the problem that the character does not reach BO.
    I have opened a ticket concerning that. SAP 1th level support is telling me that this is not a BO problem. They say it is a problem of Tomcat. I don't believe that because the log on with authentification type SAP is working.
    I have set up the same combination (AD User Test-BÖ with SAP User Test-BÖ) as a single sign on authentification in SAP BW and there it is working without problems.
    Which leads me to the conlusion: It is not a problem of AD. It is something which is connected to the BO platform but only combined with logon type AD because SAP Logon is working with language specific characters.

    I have found this article with BO support:
    You cannot add a user name or an object name that only differs by a character with a diacritic mark
    Basically this means AD stores the country specific letters as a base letter internally. Which means that if you have created a user with a country specific letter in the name you can also logon with the Base letter to Windows.
    SAP-GUI and Windows are maybe replacing the country specific letters by the base letter. Due to that SSO is working. BO seems not to be able to do that. Up to now the supporter from BO is telling me that this is not a BO problem.
    Seems to be magic that the colleagues of SAP-GUI are able to to it.

  • Problem with language specific characters on e-mail sending

    Hi,
    Problem with language specific characters on e-mail sending.
    How can it be fixed?
    Thanks.

    Hi,
    try to work on the charecter code set UTF-8 or UTF-16. You can define this in html.
    Or encode the charecter using java script.
    Hope this may help you.
    Deepak!!!

  • Runtime.exec() under a specific user account ???

    Hi there,
    I cann't figure out how to run a script on Unix under a specific user account using the Runtime.exec(). Currently whoever run the java program, the script is ran under that user account.
    The code is like:
    public class javarun {
    public static void main(String[] arg) {
    String str = "myunixscript";
    // check the arg[1] to decide the appropriate environment.
    Runtime r = Runtime.getRuntime();
    try {
    Process pr = r.exec(str);
    pr.waitFor();
    int exitstatus = pr.exitValue();
    } catch (...) {...}
    We have two user accounts: unixusr1 and unixusr2. Now I need to have unixusr1 run the java program ( ie. unixusr1$ java javarun), while the "myunixscript" be executed under unixusr2. One further step is to the unix account name as a parameter so the unixscript could be run under different account.
    Any help will be highly appreciated. Thanks.
    Edward.

    I'm not sure if I have a solution, but here are some questions:
    a) have you tried writing additional input to the OutputStream of the process? Although I have not tried it, I would imagine that Process.getOutputStream() exists for commands that require the invoking resource to send additional input to the process- like an su command that requires a password check.
    b) can you just write a shell script that takes the needed information as an argument. That is, write a shell script that takes the username and password as an argument and then you can use Runtime like,
    Runtime.exec("myScript", new String[] { "hisId", "hisPasswd" });Obviously, you would need to think through the security concerns of such a script, but, if it complies with the security structure of your environment, it might allow you to avoid the problem by using the shell script to invoke the destination command with the proper UID and password, rather then using the JVM to invoke it. Basically, the script becomes a proxy for the JVM to invoke that command.

  • Runtime.exec() with japanese arguments?

    I'm trying to invoke a C++ executable from java using the Runtime.exec() method. The C++ application accepts a filename as a command line argument & opens the file. This C++ app is unicode enabled i.e. it can accept UTF-16 (wide char) parameters. Howevere, when i invoke this application using Java's Runtime.exec() and specify a japanese file name as an argument, the japanese characters get converted to '?' characters by the time they are received in the C++ application. I'm running this application on Windows 2K, default i.e. English version.
    Looking at the source code of Runtime class, it seems that the exec()
    function makes use of a native helper function - execInternal(). Does
    this function support the entire unicode range?
    Is there any way we can avoid the conversion of japanese characters to '?' characters? Also, is there any other alternative for invoking an external application with Unicode (Say, japanese) arguments?
    Please reply ASAP.
    Thanks!

    I have a very similar problem. I am invoking cvs through Runtime.exec, and I am using it to add and check in files with chinese characters in the name, and it is failing with the following cvs error:
    Could not add resource file &#32435;&#20986; in directory C:\test to repository: cvs add: nothing known about ??
    The error message comes from cvs, and I have been able to track it down to the call string I pass to exec. It is correct when passed in but the command fails. For laughs I tried to call something simpler, like mkdir:
    err mkdir ?? is: The filename, directory name, or volume label syntax is incorrect.
    It seems pretty clear to me that although the callstring is correct, the call to exec fails, and the special characters are replaced with questionmarks, which seems to me to be an encoding issue.
    Did you get any solution to your problem, or does anyoen else have an answer for this?

  • Problem with language specific letters in Translation Builder editor

    Hello,
    I'm trying to translate some reports from Slovenian to Croatian using OTB, but as soon as I scroll up or down through translation form some Croatian language specific letters (čćžšđ) either convert to c (čć) or d (đ) or become "unreadable" (šž). The latest (šž) are displayed correctly on the report when strings are exported back to RDF file.
    According Troubleshooting section in OTB help I tried to change both base and translation font but with no success.
    Any experience, any hint or trick?
    Thanks in advance.
    Dev6i patch10
    RDBMS=Oracle10g
    WinXPsp2
    NLS_LANG=CROATIAN_CROATIA.EE8MSWIN1250

    Naveen,
    This is more of a portal problem.
    First, you should submit an OSS message to get the <b>best support possible</b> from SAP.
    Second, if you don't like that solution, THEN come back and post it on SDN. You will get better answers in the Enterprise Portal forum here on SDN.
    Regards,
    Greg

  • Runtime.exec with a unix shell script

    I've done a lot of google'ing and haven't found a definitive answer to my question, including the JavaWorld article that is pointed to quite often. Scenario1 - The program calling Runtime.exec is running in /dir1 and I have a script called test.sh in /dir2 (neither directory are in the path). If I call Runtime.exec("test.sh", null, "/dir2"), I get java.io.IOException: test.sh: not found. However, if I do "touch test.sh" AND "chmod +x test.sh" in /dir1 and call the same exec, it works AND runs the script in /dir2 not /dir1?!?! Also, if I copy /dir2/test.sh /dir1/test.sh and I call exec("test.sh"), it works fine. Scenario2 - If I get rid of /dir1/test.sh and call exec("/dir2/test.sh", null, "/dir2") OR exec("/bin/sh test.sh", null, "/dir2") - both of those work. I just don't get Scenario1. Why does having the dummy executable test.sh in /dir1 allow it to run in /dir2 OR if the script is in the local directory of the process calling exec, why does it work without adding the path? It doesn't seem consistent. Seems like the working directory I specify isn't set before trying to run it or something. On the flip side, if I have a java class in /dir2 called test.class, I can call exec("java test", null, "/dir2") and it just runs without jumping through any hoops - although I think the explanation for that is that "java" is in the path. Let me know what you think.
    Gary

    I think the problem is that the three argument version of exec specifies the command to run (should be full path to it if it is not in the current dir), the environment, then the working directory. The working directory will not help java to find the command to run in the first place. The following does work as you say:
    Runtime.exec("/bin/sh test.sh",null,"/dir2");This is because the full path to the command (/bin/sh) is specified, that runs in directory /dir2 then tries to find test.sh which it finds there.
    Basically to run anything, you should specify the full path in the command, the working directory will not help java find it.
    Dave

  • Runtime.exec() with envp[] array

    I ran into an unsual problem.
    If I set an env array variable to something (at least one pair), then certain applications fail to start through Runtime.exec(command[], env[]). For example, my own java classes that require various xml and ftp libraries. The particular exception has been mentioned on the forum ( ie. Unrecognized Windows Sockets error: 10106:).
    It has to do with environment variables not being set for new process. When I do NOT set env[] variable (or pass null) then current env is used in .exec() call and everything works fine.
    So my question is how do I set my environment variables and/or append them to existing set.Or said differently if I pass a non-null array, current env set is not copied over.
    thanks,
    eugene

    >
    It has to do with environment variables not being set for new process. When I do NOT set env[] variable (or pass null) then current env is used in .exec() call and everything works fine.
    So my question is how do I set my environment variables and/or append them to existing set.Or said differently if I pass a non-null array, current env set is not copied over.
    >
    If you're using 1.5, you can create a java.lang.ProcessBuilder object rather than calling Runtime.exec(). The ProcessBuilder inherits the environment of the calling process, but then allows you to update individual entries.
    In 1.4, I don't believe that you can get a complete copy of the invoker's environment.

  • Runtime.exec with spaces not working EVEN using String[]!!

    Hi everyone,
    I need to start the rmi registry from some code,and i need to pass it the classpath of two jars when initialising it. My problem is that the paths I set aren't taken when they contain a space.
    Here's the code:
    <code>
    String rmiRegistryCommandLine[] = new String[] {
    + System.getProperty("java.home")
    + "\\bin\\rmiregistry.exe\"",
    "-J-Djava.class.path=\""+System.getProperty("user.dir")+"\\MyJar.jar\"",
    "1099"};
                                            Runtime.getRuntime().exec(rmiRegistryCommandLine);
    </code>
    I know that Runtime.exec(String) tokenizes the input, which is why I'm not using it, but Runtime.exec(String[]) isn't supposed to tokenize the input. System.getProperty("user.dir") can contain a space, so I put quotes around that, but I need the -J-Djava.class.path in the same string. I tried breaking it up into two more separate strings but it didn't even run for normal non-space paths then. I am sure that if the whole -J-Dblah....upto MyJar.jar was in quotes then it would work, but I need the classpath in quotes separately as it could contain a space.
    Can anyone help me get this working?

    Ya, that's fine but the command line I want to pass is:
    d:\j2sdk1.4.0\bin\rmiregistry.exe -J-Djava.class.path=d:\my dir with spaces\MyJar.jar;d:\my more dir with spaces\MyJar2.jar 1099
    If I say
    arg[0]="d:\\j2sdk1.4.0\\bin\rmiregistry.exe";, that's finebut arg[1] is the problem
    if I say
    arg[1]="-J-Djava.class.path=d:\\my dir with spaces\MyJar.jar; d:\\my more dir with spaces\\MyJar2.jar";, then it definitely won't work on 9X machines and probably not on NT.
    if I break up arg[1] into:
    arg[1]="-J-Djava.class.path=";
    arg[2]="d:\\my dir with spaces\\MyJar.jar";
    arg[3]=";";
    arg[4]="d:\\my more dir with spaces\\MyJar2.jar";I'll need to put quotes around the two individual two class paths or else it won't work.
    I find though that if I put the classpath as follows
    d:\"my dir with spaces"\MyJar.jar then it seems to work.
    I think a regular expression function to search for any directory with spacees and then put quotes around it and reinsert it into the path would be the solution.

  • Runtime.exec() with get command output

    hi,
    How can i get output of command which i run with runtime.exec().
    p.e.:
    Process p;
    Runtime r = Runtime.getRuntime();
    p = r.exec("net use \\pc\dir pswd /user:username");
    if command was done succesfully that in cmd is return this:
    "The command completed successfully." I can get this text, but i dont know how.
    Plese help
    thank you
    Palo

    Look at the API for Process

  • Runtime.exec with Unix script

    I want to execute unix script xxx.sh that I write it for running something and I will execute that script via java class I use
    Runtime runTime = Runtime.getRuntime();
    Process procRun = runTime.exec("/xxx/yyyy/testing.sh");
    xxx and yyyy is path in my unix server and testing.sh is unix script
    when I run this class it return true result but that unix script doesn't working or execute following my program in java class
    please help me to solve this problem
    Regards,
    sobig

    when I run this class it return true result but that unix script doesn't
    working or execute following my program in java classwhat do you mean it returns true....
    and how do you know that it does not execute your script.... its probably going to be started as a bg process.... try doing something like creating a directory or something in the script .sh to be sure that it ran.... (just for testing).... im quite sure that it will execute a .sh file like that....

  • Stuck On Runtime.exec() with cmd.exe

    I've done my best to look through the forums and implement what's been said but I'm getting a problem where my whole Java program freezes when the exec() is executed. Can anyone tell me what I'm missing or have misunderstood ?
            try
                Process runSmodels = Runtime.getRuntime().exec("C:\\Windows\\System32\\cmd.exe lparse predict.pl | smodels 0");
                String smodelsOutput = new String();
                BufferedReader smodelsReader = new BufferedReader(new InputStreamReader(runSmodels.getInputStream()));
                String outputLine = smodelsReader.readLine();
                while(outputLine != null)
                    smodelsOutput += outputLine;
                    outputLine = smodelsReader.readLine();
                smodelsReader.close();
                System.out.println(smodelsOutput);
            catch(IOException exc)
                JOptionPane.showMessageDialog(rootPane, "Could not access Smodels.", "System Call Error", JOptionPane.ERROR_MESSAGE);
            }

    DarioAtUOW wrote:
    Pitfall 1 : Calling .exitValue(). My code doesn't do that.
    Pitfall 2 :Not enptying relevant streams. I do empty the input stream.
    Pitfall 3 : Assuming a command is an executable program. I don't do that, cmd.exe is in my command string explicitly.
    Pitfall 4 : As above in Pitfall 3.
    So, why accuse me of not reading the article ? You probably have many years of experience at Java, unlike me, who is just starting out with it at university.Pitfall 2 : Even though you are processing stdout you are not processing stderr! Always always always process both. This may or may not be the cause of your problem but by copying the process stderr to your System.err you may see why your process is stuck.
    Even Clippy, the Microsoft Office Assistant, could answer questions better than you have attempted to do.Ouch, I'm cut to the bone on your razor sharp wit. Phuck you.

  • Issues with language-specific characters and Multi Lexer

    I want to create a text index with global lexer and different languages. But how to create the index to satisfy all languages?
    Oracle EE 10.2.0.4 (UTF8) on Solaris 10
    1.) Create global lexer with german as default and czech, turkish as additional languages.
    begin
         ctx_ddl.drop_preference('global_lexer');
         ctx_ddl.drop_preference('german_lexer');
         ctx_ddl.drop_preference('turkish_lexer');
         ctx_ddl.drop_preference('czech_lexer');
    end;
    begin
         ctx_ddl.create_preference('german_lexer','basic_lexer');
         ctx_ddl.create_preference('turkish_lexer','basic_lexer');
         ctx_ddl.create_preference('czech_lexer','basic_lexer');
         ctx_ddl.create_preference('global_lexer', 'multi_lexer');
    end;
    begin
         ctx_ddl.set_attribute('german_lexer','composite','german');
         ctx_ddl.set_attribute('german_lexer','mixed_case','no');
         ctx_ddl.set_attribute('german_lexer','alternate_spelling','german');
         ctx_ddl.set_attribute('german_lexer','base_letter','yes');
         ctx_ddl.set_attribute('german_lexer','base_letter_type','specific');
         ctx_ddl.set_attribute('german_lexer','printjoins','_');
         ctx_ddl.set_attribute('czech_lexer','mixed_case','no');
         ctx_ddl.set_attribute('czech_lexer','base_letter','yes');
         ctx_ddl.set_attribute('czech_lexer','base_letter_type','specific');
         ctx_ddl.set_attribute('czech_lexer','printjoins','_');
         ctx_ddl.set_attribute('turkish_lexer','mixed_case','no');
         ctx_ddl.set_attribute('turkish_lexer','base_letter','yes');
         ctx_ddl.set_attribute('turkish_lexer','base_letter_type','specific');
         ctx_ddl.set_attribute('turkish_lexer','printjoins','_');
         ctx_ddl.add_sub_lexer('global_lexer', 'default', 'german_lexer');
         ctx_ddl.add_sub_lexer('global_lexer', 'czech',   'czech_lexer',   'CZH');
         ctx_ddl.add_sub_lexer('global_lexer', 'turkish', 'turkish_lexer', 'TRH');
    end;
    /2.) Create table and insert data
    drop table text_search;
    create table text_search (
         lang   varchar2(5)
       , name   varchar2(100)
    insert into text_search(lang, name) values ('DEH', 'Strauß');
    insert into text_search(lang, name) values ('DEH', 'Möllbäck');
    insert into text_search(lang, name) values ('TRH', 'Öğem');
    insert into text_search(lang, name) values ('TRH', 'Öger');
    insert into text_search(lang, name) values ('CZH', 'Tomáš');
    insert into text_search(lang, name) values ('CZH', 'Černínová');
    commit;3.) The index creation now produces different results depending on the language settings:
    -- *Option A)*
    alter session set nls_language=german;
    drop index i_text_search;
    create index i_text_search on text_search (name)
       indextype is ctxsys.context
            parameters ('
                    section group CTXSYS.AUTO_SECTION_GROUP
                    lexer global_lexer language column lang
                    memory 300000000'
    select * from dr$i_text_search$I;
    -- *Option B)*
    alter session set nls_language=turkish;
    drop index i_text_search;
    create index i_text_search on text_search (name)
       indextype is ctxsys.context
            parameters ('
                    section group CTXSYS.AUTO_SECTION_GROUP
                    lexer global_lexer language column lang
                    memory 300000000'
    select * from dr$i_text_search$I;
    -- *Option C)*
    alter session set nls_language=czech;
    drop index i_text_search;
    create index i_text_search on text_search (name)
       indextype is ctxsys.context
            parameters ('
                    section group CTXSYS.AUTO_SECTION_GROUP
                    lexer global_lexer language column lang
                    memory 300000000'
    select * from dr$i_text_search$I;And now I get different:
    Option A)
    dr$i_text_search$I with nls_language=german:
    STRAUß
    STRAUSS
    MOLLBACK
    OĞEM
    OGER
    TOMAŠ
    ČERNINOVA
    Problems, e.g.:
    A turkish client now does not find his data (the select returns 0 rows)
    alter session set nls_language=turkish;
    select * from text_search
    where contains (name, 'Öğem') > 0;
    Option B)
    dr$i_text_search$I with nls_language=turkish:
    STRAUß
    STRAUSS
    MÖLLBACK
    ÖĞEM
    ÖGER
    TOMAŠ
    ČERNINOVA
    Problems, e.g.:
    A czech client now does not find his data (the select returns 0 rows)
    alter session set nls_language=czech;
    select * from text_search
    where contains (name, 'Černínová') > 0;
    Option C)
    dr$i_text_search$I with nls_language=czech:
    STRAUß
    STRAUSS
    MOLLBACK
    OĞEM
    OGER
    TOMAS
    CERNINOVA
    Problems, e.g.:
    A turkish client now does not find his data (the select returns 0 rows)
    alter session set nls_language=turkish;
    select * from text_search
    where contains (name, 'Öğem') > 0;
    ----> How can these problems be avoided? What am I doing wrong?

    You need to change your base_letter_type from specific to generic. Also, if you are going to use both alternate_spelling and base_letter in your german_lexer, then you might want to set override_base_letter to true. Please see the run of your code below, with those changes applied. The special characters got mangled in my spool file, but hopefully you get the idea.
    SCOTT@orcl_11gR2> begin
      2            ctx_ddl.drop_preference('global_lexer');
      3            ctx_ddl.drop_preference('german_lexer');
      4            ctx_ddl.drop_preference('turkish_lexer');
      5            ctx_ddl.drop_preference('czech_lexer');
      6  end;
      7  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> begin
      2            ctx_ddl.create_preference('german_lexer','basic_lexer');
      3            ctx_ddl.create_preference('turkish_lexer','basic_lexer');
      4            ctx_ddl.create_preference('czech_lexer','basic_lexer');
      5            ctx_ddl.create_preference('global_lexer', 'multi_lexer');
      6  end;
      7  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> begin
      2            ctx_ddl.set_attribute('german_lexer','composite','german');
      3            ctx_ddl.set_attribute('german_lexer','mixed_case','no');
      4            ctx_ddl.set_attribute('german_lexer','alternate_spelling','german');
      5            ctx_ddl.set_attribute('german_lexer','base_letter','yes');
      6            ctx_ddl.set_attribute('german_lexer','base_letter_type','generic');
      7            ctx_ddl.set_attribute('german_lexer','override_base_letter', 'true');
      8            ctx_ddl.set_attribute('german_lexer','printjoins','_');
      9 
    10            ctx_ddl.set_attribute('czech_lexer','mixed_case','no');
    11            ctx_ddl.set_attribute('czech_lexer','base_letter','yes');
    12            ctx_ddl.set_attribute('czech_lexer','base_letter_type','generic');
    13            ctx_ddl.set_attribute('czech_lexer','printjoins','_');
    14 
    15            ctx_ddl.set_attribute('turkish_lexer','mixed_case','no');
    16            ctx_ddl.set_attribute('turkish_lexer','base_letter','yes');
    17            ctx_ddl.set_attribute('turkish_lexer','base_letter_type','generic');
    18            ctx_ddl.set_attribute('turkish_lexer','printjoins','_');
    19 
    20            ctx_ddl.add_sub_lexer('global_lexer', 'default', 'german_lexer');
    21            ctx_ddl.add_sub_lexer('global_lexer', 'czech',   'czech_lexer',   'CZH');
    22            ctx_ddl.add_sub_lexer('global_lexer', 'turkish', 'turkish_lexer', 'TRH');
    23  end;
    24  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> drop table text_search;
    Table dropped.
    SCOTT@orcl_11gR2> create table text_search (
      2         lang      varchar2(5)
      3       , name      varchar2(100)
      4  );
    Table created.
    SCOTT@orcl_11gR2> insert into text_search(lang, name) values ('DEH', 'Strauß');
    1 row created.
    SCOTT@orcl_11gR2> insert into text_search(lang, name) values ('DEH', 'Möllbäck');
    1 row created.
    SCOTT@orcl_11gR2> insert into text_search(lang, name) values ('TRH', 'Öğem');
    1 row created.
    SCOTT@orcl_11gR2> insert into text_search(lang, name) values ('TRH', 'Öger');
    1 row created.
    SCOTT@orcl_11gR2> insert into text_search(lang, name) values ('CZH', 'Tomáš');
    1 row created.
    SCOTT@orcl_11gR2> insert into text_search(lang, name) values ('CZH', 'ÄŒernÃnová');
    1 row created.
    SCOTT@orcl_11gR2> commit;
    Commit complete.
    SCOTT@orcl_11gR2>
    SCOTT@orcl_11gR2> -- *Option A)*
    SCOTT@orcl_11gR2> alter session set nls_language=german;
    Session altered.
    SCOTT@orcl_11gR2> drop index i_text_search;
    drop index i_text_search
    ERROR at line 1:
    ORA-01418: Angegebener Index ist nicht vorhanden
    SCOTT@orcl_11gR2> create index i_text_search on text_search (name)
      2       indextype is ctxsys.context
      3            parameters ('
      4                 section group CTXSYS.AUTO_SECTION_GROUP
      5                 lexer global_lexer language column lang
      6                 memory 300000000'
      7            );
    Index created.
    SCOTT@orcl_11gR2> select token_text from dr$i_text_search$I;
    TOKEN_TEXT
    AYEM
    AŒERNA
    CK
    GER
    LLBA
    MA
    NOVA
    STRAUAY
    TOMA
    9 rows selected.
    SCOTT@orcl_11gR2> alter session set nls_language=turkish;
    Session altered.
    SCOTT@orcl_11gR2> select * from text_search
      2  where contains (name, 'Öğem') > 0;
    LANG
    NAME
    TRH
    Öğem
    1 row selected.
    SCOTT@orcl_11gR2>
    SCOTT@orcl_11gR2> -- *Option B)*
    SCOTT@orcl_11gR2> alter session set nls_language=turkish;
    Session altered.
    SCOTT@orcl_11gR2> drop index i_text_search;
    Index dropped.
    SCOTT@orcl_11gR2> create index i_text_search on text_search (name)
      2       indextype is ctxsys.context
      3            parameters ('
      4                 section group CTXSYS.AUTO_SECTION_GROUP
      5                 lexer global_lexer language column lang
      6                 memory 300000000'
      7            );
    Index created.
    SCOTT@orcl_11gR2> select token_text from dr$i_text_search$I;
    TOKEN_TEXT
    AYEM
    AŒERNA
    CK
    GER
    LLBA
    MA
    NOVA
    STRAUAY
    TOMA
    9 rows selected.
    SCOTT@orcl_11gR2> alter session set nls_language=czech;
    Session altered.
    SCOTT@orcl_11gR2> select * from text_search
      2  where contains (name, 'ÄŒernÃnová') > 0;
    LANG
    NAME
    CZH
    ÄŒernÃnová
    1 row selected.
    SCOTT@orcl_11gR2>
    SCOTT@orcl_11gR2> -- *Option C)*
    SCOTT@orcl_11gR2> alter session set nls_language=czech;
    Session altered.
    SCOTT@orcl_11gR2> drop index i_text_search;
    Index dropped.
    SCOTT@orcl_11gR2> create index i_text_search on text_search (name)
      2       indextype is ctxsys.context
      3            parameters ('
      4                 section group CTXSYS.AUTO_SECTION_GROUP
      5                 lexer global_lexer language column lang
      6                 memory 300000000'
      7            );
    Index created.
    SCOTT@orcl_11gR2> select token_text from dr$i_text_search$I;
    TOKEN_TEXT
    AYEM
    AŒERNA
    CK
    GER
    LLBA
    MA
    NOVA
    STRAUAY
    TOMA
    9 rows selected.
    SCOTT@orcl_11gR2> alter session set nls_language=turkish;
    Session altered.
    SCOTT@orcl_11gR2> select * from text_search
      2  where contains (name, 'Öğem') > 0;
    LANG
    NAME
    TRH
    Öğem
    1 row selected.
    SCOTT@orcl_11gR2>

  • Runtime.exec with wget

    Hi,
    well i want to execute wget command in a java class and print sdout in the shell
    this is my code:
              try {
                   Process ls_proc = Runtime.getRuntime().exec("wget http://antimilkado.free.fr/ted/screenshot.png");
                   BufferedReader ls_in = new BufferedReader(new InputStreamReader(ls_proc.getInputStream()));
                   try {
                        while ((ls_str = ls_in.readLine()) != null) {
                             System.out.println(ls_str);
                   catch (IOException e) {
                        System.err.println(e);
                        System.exit(0);
              }I've tested with other basic command like ls and co., it works but not with a wget, nothing is printed...
    I guess my code is good and there is maybe a problem with wget command i don't know
    If someone gets it :)
    thx
    ++
    SHiSo

    1) Get the InputStream from the connection.
    2) Open a FileOutpupStream to the file you wish to write.
    3) Loop reading bytes from the InputStream and write them to the FileOutputStream until you get EOF.
    e.g.
    InputStream is = ...
    FileOutputStream os = ...
    byte[] buffer = new byte[4096];// or any size you want
    for (int count = 0; (count = is.read(buffer)) >= 0;)
    os.write(buffer, 0, count);
    4) flush() then close() the FileOuputStream.

Maybe you are looking for