T2K/T5K type of Solaris servers and Runtime.exec

It is being consistently observed that on T2k/T5k type of Solaris servers (e.g. T5220), the UNIX commands sent from Java using the Runtime class APIs are not being reveived by Solaris. It does not happen always, only occasionally. But when it happens, the java process hang at process.waitFor(). We are using Java1.6.
I read the Java World article "When Runtime.exec() won't" and the behavior we are seeing is not because of any of the known pitfalls mentioned in the article. Also the warning in the Runtime API that speaks about the limited buffer size is also not applicable in this case because we do see it working sometimes. All of a sudden Runtime.exec gets stuck. We have also observed that the problem is not dependent on the command we pass through the Runtime.exec API. It happens for any trivial command.
For more information on the issue, when we execute a 'pstack' on the process id, we see the following output most of the time and the 'truss' output shows the java process to be in a sleeping state:
# pstack 20650
ff2c52d8 lwp_park (0, 0, 0)
ff2bf350 cond_wait_queue (24dd90, 24dd78, 0, 0, 0, 0) + 28
ff2bf770 cond_wait_common (24dd90, 24dd78, 0, 0, 0, 0) + 294
ff2bf874 cond_wait (24dd90, 24dd78, 0, 0, 0, 0) + 10
ff2bf8b0 pthread_cond_wait (24dd90, 24dd78, ff2f3700, 0, f337da00, ecf00000) + 8
eedddacc kernel_delete_session (24dd60, 24dd58, 0, 1, 3, 1c63c) + 114
eeddd7dc kernel_delete_all_sessions (0, 1, 0, 1c8b4, 0, eedfa000) + 98
eedd1eb4 cleanup_library (0, 1, 0, eedfa000, 28180, 3) + 3c
eedd1f1c kernel_fini (0, 1, 0, eedfa000, 28120, eedfa4a4) + 44
eede89e0 _fini (ff3f40fc, ff3f5a70, 2b3f4, 0, ff3f4910, 821) + 4
ff3c54b4 call_fini (ff3f40fc, f43518f0, eede89dc, ff3f42f0, ff3f42a8, ff3f4910) + cc
ff3cfdc0 remove_hdl (f43518f0, f1c4e2bc, 0, 4000, ff300a54, 4821) + ac8
ff3ca408 dlclose_intn (f4351978, ff3f4910, ff3f40fc, 2a520, ff3ca4bc, 0) + 24
ff3ca4e8 dlclose (f4351978, 0, f4350b88, 0, 1c00, 1) + 24
eee33904 pkcs11_slottable_delete (1, f9e2c0, 46ec90, eee46bb0, 0, 1) + 138
eee2e42c pkcs11_fini (eee46b8c, 1, eee2e074, eee46000, 17c18, eee46b84) + 4c
ff241f38 postforkchild_handler (1d18, ff2f3700, 1c00, 4, f337da00, ff2f3700) + 30
ff2b74bc fork (0, 41, 0, f1c4e744, ff2f3700, f337da00) + 144
fe8a8ee4 Java_java_lang_UNIXProcess_forkAndExec (ffffffff, 0, fee0c0, fe8c4000, 4, 2) + 6d0
f940bc20 * java/lang/UNIXProcess.forkAndExec([B[BI[BI[BZLjava/io/FileDescriptor;Ljava/io/FileDescriptor;Ljava/io/FileDescriptor;)I+-20552
f940bbc4 * java/lang/UNIXProcess.forkAndExec([B[BI[BI[BZLjava/io/FileDescriptor;Ljava/io/FileDescriptor;Ljava/io/FileDescriptor;)I+0
f94058b8 * java/lang/UNIXProcess.<init>([B[BI[BI[BZ)V+62
f9405764 * java/lang/ProcessImpl.start([Ljava/lang/String;Ljava/util/Map;Ljava/lang/String;Z)Ljava/lang/Process;+182
f9405874 * java/lang/ProcessBuilder.start()Ljava/lang/Process;+112
f9405874 * java/lang/Runtime.exec([Ljava/lang/String;[Ljava/lang/String;Ljava/io/File;)Ljava/lang/Process;+16                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

If you haven't found the answer yet, I found it in another article. Basically, * and other wildcards are expanded by the shell so Runtime.getRuntime()exec("ls /tmp/*") won't work. You need to use the String[ ] form of exec(), i.e. Runtime.getRuntime()exec( new String[ ] {"sh", "-c", "ls /tmp/*"} )
hope that helps.

Similar Messages

  • Monitoring Oracle Virtual Machine for Solaris servers and LDOMs

    Hi all,
      could anyone tell me if we can monitor Oracle Virtual Machine for Solaris servers and LDOMs with only Oracle Enterprise Manager Cloud Control 12c, or shall we need to install Ops Center ?
    Thank you in advance.

    I had the same issue. Upgrading Virtual box from 4.1.16 to 4.1.20 solved the problem.

  • To jschell How to get data System properties by JNI and Runtime.exec()

    Thank you very much for answer. ummm....but I'm can not gets data system properties by JNI or Runtime.exec(). Please help me. I'm want create Java-Applet for data System properties ( memory quantity?, Harddisk capacity?, CPU speed ?, Printer Name? and all hardwares ) in my computer. It very important for me. Help me please. thank you..

    Java applets are restricted to accessing only some system properties - and it is good so. I would not be happy if any applet could inquire about, say, my user name or the amount of memory in my box.

  • Difference between command line and Runtime.exec()

    Hi all.
    I'm coding some lines to call sqlldr program.
    System info:
    OS: Win2k server
    Java platform: JSK 1.4
    DBMS: Oracle 9i
    I've tested sqlldr in command line and it is OK. But when i call Runtime.exec("sqlldr user/pass@servicename control=mycontrol.ctl")
    the ErrorStream show that: Message 2100 not found,No message file for product=RDBMS ,facility=UL...
    So i had to put a String array which contained "ORACLE_HOME" as the second parameter of exec method. But there's another error appear:
    SQL*Loader-704: Internal error: ulconnect: OCIServerAttach [0]
    ORA-12560: TNS:protocol adapter error
    I checked tnsnames.ora and it's OK. I do the command line again and it's still OK. Why did Runtime.exec("...") method get Error.
    Does Someone solve it for me.
    Thanks so much.

    I'm having the similar/same issue.
    I'm trying to run SQLLdr from JAVA.
    From a command line, it works fine.. From within JAVA, I get..
    SQL*Loader-704: Internal error: ulconnect: OCIServerAttach [0]
    ORA-12640: Authentication adapter initialization failed.
    Did you find a solution to your problem?

  • Java GUI and runtime().exec help

    I have been working on a GUI that does an assortment of tasks. The final and last task is to make copies of a 3dModel conversion program and a script file that is required to make the converter run and convert. The converter and the script file are moved to a user specified directory. The user specified directory contains all of the models that will be converted. The problem is, I can't get the GUI to boot the converter with the script file. To make the converter work, you need to pass two window's cmd commands but the commands need to occur from the same directory as the converter and script file. This is what I have tried to do:
    String[] commands = new String[]{"cmd ",
    "/c ",
    "cd ",
    smdDirectory.getPath(),
    "skmodel ",
    "model_definition.txt "};
    try{               
    Process child = Runtime.getRuntime().exec(commands);}
    catch(IOException e){}The files have all ready copied to the correct directory. All I need is for the GUI to execute the "skmodel model_definition.txt" commands in the correct directory. What am I doing wrong?
    Thanks for the help in advance.

    String[] commands = new String[]{"cmd ",
    "/c ",
    "skmodel ",
    "model_definition.txt "};
    try{               
    Process child = Runtime.getRuntime().exec(commands, null, smdDirectory.getPath());}
    catch(IOException e){}I will try that and see if I get the desired results.
    EDIT:
    I got it to make. Here is the code.
    String[] commands = new String[]{"cmd ", "/c ", "skmodel",     "model_definition.txt "};
         try{
              Runtime runtime = Runtime.getRuntime();               
              Process child = runtime.exec(commands, null, smdDirectory);
    }Edited by: Euphoria on Sep 28, 2008 9:48 AM

  • Process communication and runtime.exec()

    I need to create a java class that interacts with a non-java application. The non-java application is a spell checking program which reads a misspelling from stdin and writes a list of suggestions to stdout.
    I want a java class that will act as a gateway to this application so I can do the following:
    JavaGatewayToSpellChecker checker = new JavaGatewayToSpellChecker();
    String[] suggestions = checker.checkWord("misssspelling");Here is how I have the class set up so far:
    import java.io.*;
    public class JavaGatewayToSpellChecker()
        BufferedWriter writer;
        BufferedReader reader;
        public JavaGatewayToSpellChecker()
            try
                String[] cmd = new String[2];
                cmd[0] = "aspell";
                cmd[1] = "-a";
                Runtime rt = Runtime.getRuntime();
                System.out.println("Execing " + cmd[0] + " " + cmd[1]);
                Process proc = rt.exec(cmd);
                writer = new BufferedWriter(new OutputStreamWriter(proc.getOutputStream()));
                reader = new BufferedReader(new InputStreamReader(proc.getInputStream()));
            catch (IOException ioe)
                ioe.printStackTrace();
    // no problems yet, as far as I can tell.
    public String checkWord(String word)
            String reply = new String();
            try
                writer.write(word);
                String line = reader.readLine();
    // I know that a line that begins with one of the following
    // characters signals the end of the suggestion list
                while (! (line.startsWith("*") || line.startsWith("&") || line.startsWith("#")))
                    reply = reply + line;
                    line = reader.readLine();
            catch (IOException ioe)
                ioe.printStackTrace();
    String suggestions[] = parseReply();
    // code for parseReply() is omitted for brevity, but I
    // never get down this far anyway. The code just hangs
    // in the loop.
            return suggestions;
        }What am I doing wrong? I have seen a solution using a thread that just runs all the time gobbling the output and either throwing it away or writing it to a file, but I need the output returned so I can parse it and pass it back to the calling method.
    I will be really impressed if anyone can solve this problem.
    Thanks,
    Jon

    Well, you guys were no help at all. I spent hours reading the java forums and tried everything under the sun. I had a separate thread read the output and then tried to communicate with that thread using PipedReader/PipedWriter. I can read the output and write it to a file or print it, but I can't bloody pass it back to the calling method. What am I missing??
    Finally I just made the class static and decided to exec the entire process everytime I need it. Since I have to spell check a couple hundred thousand strings I'm just going to have to start and stop the process a couple hundred thousand times. This is the most retarded programming solution I have ever come up with. I can't believe the guys who wrote the java.lang.Runtime package couldn't do any better than this. From what I can tell from reading the boards I am not the only person who has struggled with this issue.
    There is clearly an elegant solution that anyone with six years of java experience and a week of free time on their hands could come up with, but for those of us who have only been programming since 2001 and who have to get on with life I guess it makes more sense just to let the computer run all night on a dumbass solution than try to divine the solution to this problem.
    AAARRGGGHHHH. I just have to rant a bit. I wasted a whole day :(
    My solution:
    import java.io.*;
    public class JavaGatewayToSpellChecker
        public static String checkWord(String word)
            String reply = new String();
            try
                String[] cmd = new String[2];
                cmd[0] = "aspell";
                cmd[1] = "-a";
                Runtime rt = Runtime.getRuntime();
                System.out.println("Execing " + cmd[0] + " " + cmd[1] );
                Process proc = rt.exec(cmd);
                BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(proc.getOutputStream()));
                BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getInputStream()));
                System.err.println("writing: "+word);
                writer.write(word);
                writer.newLine();
                writer.close();
                String line;
                while ( (line=reader.readLine()) != null)
                    reply += line;
                int exitVal = proc.waitFor();
            catch (Exception e)
                e.printStackTrace();
            return reply;
    [\code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Runtime.exec() and fork() and Process

    So let me see if I understand this correctly, and if I don't please fill me in. If I call the following piece of codeRuntime.getRuntime().exec("chgrp rcsweb " + path+fs+orgName);
    Runtime.getRuntime().exec("chmod 660 " + path+fs+orgName);where path is the real path to a file, fs is short for File.spearator and orgName is the name of a file, then in the Unix environment, it will fork off a process.
    First, I seem to remember one forum topic that mentioned not forgetting about killing the process returned by exec, so I guess I need to add that to my code.
    Second, since I am forking off this process inside of a J2EE container, am I actually forming off the entire container, or just the Servlet where Runtime is called, or what?
    Third, how can I prevent the error java.io.IOException: Not enough space
    at java.lang.UNIXProcess.forkAndExec(Native Method)
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:54)
    at java.lang.Runtime.execInternal(Native Method)
    at java.lang.Runtime.exec(Runtime.java:546)
    at java.lang.Runtime.exec(Runtime.java:413)
    at java.lang.Runtime.exec(Runtime.java:356)
    at java.lang.Runtime.exec(Runtime.java:320)when I do not have the option of changing my VM size? Is killing the Process (and using waitFor()) going to take care of this issue?
    I appreciate your help.

    OK, after writing a few test programs, it is indeed clear..on unix (at least on solaris) when calling runtime.exec(..) The ENTIRE VM does indeed get forked. Therefore if your current Memory allocation for you VM is sitting at say 64MB (or you initial memory setting), another 64MB process will be created, even if you doing something as a simple
    exec("ls");
    I also tried putting runtime.exec call in its own thread hoping that if it was not in the main thread, that only that process would be forked..to no avail..the entire vm is indeed forked everytime...making runtime.exec damn near useless for server side work, and very dangerious..as you can essentialy assume you always need 2x your memory requirements.
    If anyone has figured out a workaround...any suggestions greatly appreciated.
    Some thoughts on some work-arounds
    1. Run 2 VMs (then when native calls are required..send a message to the 'native-calling vm' (insure its memory footprint is very low)
    2. Write your exec method via JNI (or does JNI calls also result in a fork of the vm on unix..)
    Test code below (threaded version)
    import java.util.*;
    import java.io.*;
    public class test5 extends Thread
         public void run()
              int loops = 0;
              while (true)
                   loops++;
                   System.out.println("---- iteration " loops "---");
                   makeNativeCall();
         public static void main(String[] args)
              try
                   System.out.println("testing on OS: " + System.getProperty("os.name"));
                   // Allocate a nice chunk of memory
                   byte[] bytes = new byte[1024 * 1000 * 50];
                   test5 tst = new test5();
                   tst.start();
                   while (true)
                        Thread.sleep(1000);
         catch(Exception e)
         {e.printStackTrace();}
    public void makeNativeCall()
              Runtime runtime = Runtime.getRuntime();
    InputStream stderr = null;
    InputStream stdout = null;
              OutputStream stdin = null;
    Process proc = null;
    long totalMem = (long)(runtime.totalMemory()/1024);
    long freeMem = (long)(runtime.freeMemory()/1024);
    long usedMem = (long)((totalMem - freeMem));
    System.out.println("VM REPORT: TOTAL(" totalMem") FREE("+freeMem+") USED(" usedMem")" );
    try
    proc = runtime.exec("sleep 1");
    stderr = proc.getInputStream();
    stdout = proc.getErrorStream();
    stdin = proc.getOutputStream();
    String line = null;
    int i = 0;
    String error = "";
    int exitVal = proc.waitFor();
    if (exitVal != 0)
    System.out.println("ERROR " +exitVal);
    System.out.println("DETIAL" +error);
    catch(Exception e)
    e.printStackTrace();
    finally
    if (stderr != null)
    try{stderr.close();}catch(Exception ignore){ignore.printStackTrace();}
                   if (stdout != null)
    try{stdout.close();}catch(Exception ignore){ignore.printStackTrace();}
                   if (stdin != null)
    try{stdin.close();}catch(Exception ignore){ignore.printStackTrace();}
    if (proc != null)
    try{proc.destroy();}catch(Exception ignore){ignore.printStackTrace();}

  • How do you prevent MS-DOS window from appearing during Runtime.exec()?

    The question below was attached to the answer for Question of the Week No. 21. I'm having the same problem. Does anyone know the answer? Put another way does anyone know how javaw does it?
    Fri Dec 18 09:59:52 PST 1998
    rkarasek
    On Windows NT 4.0, how can I prevent CreateProcess()
    from creating a cmd.exe window when using javaw and
    Runtime.exec()? No such cmd.exe window is created if
    instead I run "java" from the command line.
    I have a C++ server named "foo", and have created
    a Java applcation with Swing GUI named "foo.java".
    This GUI captures configuration information and
    then uses Runtime.exec() to start the C++ app, with
    a socket established between the Java app and C++
    app for later communication.
    This is all working fine, and the Java application
    and GUI working as expected. When I run "java foo"
    from either the NT command shell (cmd.exe) or MKS
    Korn shell (sh.exe) the Java application/GUI starts,
    and when it calls Runtime.exec() my C++ process is
    started as what appears to be a child process of the
    "java" process, that is, no cmd.exe window is created
    during the Runtime.exec("foo.exe") call.
    However, when running the same Java application from
    a shortcut on the desktop via "javaw", when I invoke
    Runtime.exec() a cmd.exe window is created before my
    C++ server is started. While things are running
    ok and my Java app can still communicate with my
    C++ server, is there anyway I can prevent this
    cmd.exe window from being created, and instead, have
    my C++ server run as a child process of javaw (or
    an independent process without a cmd.exe)?

    cmd always opens a dos window - use another console interpreter instead or just call the programm directly.
    i.e.
    Runetime.exec("c:\\myprogram.exe");
    OR
    The following demonstrates executing a command without bringing up a popup. import java.io.*;
    public class Test {
      public static void main (String args[]) throws IOException {
        String[] command = {
          "C:\\winnt\\system32\\cmd.exe", "/y", "/c",
          "dir"};
        Process p = Runtime.getRuntime().exec(command);
        InputStream is = p.getInputStream();
        InputStreamReader isr = new InputStreamReader(is);
        BufferedReader br = new BufferedReader(isr);
        String line;
        while ((line = br.readLine()) != null) {
          System.out.println(line);
    }However....
    According to bug number 4244515 in Sun's Bug Parade (http://developer.java.sun.com/developer/bugParade/bugs/4244515.html), javaw doesn't always work without bringing up new window.

  • Runtime.exec on Mac

    How to use runtime.exec on Mac. I need to start iCal and I don't know how. calling runtime.exec("iCal") , runtime.exec("/Applications/iCal") and runtime.exec("/Applications/iCal.app") throws error. Please help. I don't know anything about Mac.

    Yes I did the second way and it gives a runtime
    error. I wrote a program that accepts argument and
    then executes it using getRuntime().exec(argument);
    I am still not able to start any programs under Mac.
    The problem is that I don't know anything about Mac.Suggestion.
    Figure out how to launch it from the terminal. That should give you an idea of what the command should be I think.
    Sorry I can't remember OTOH how to get into the terminal but I know you can.

  • Runtime.exec(): VM creates batch executions???

    I wrote an application that performs a task within a loop. Therefore i setup up a prograssbar in my GUI. during testing, the progressbar showed nice progress by just perforing a Thread.sleep() as the task. Then i replace the Thread.sleep() with the real task that is execution of a system command:
                        Runtime rt = Runtime.getRuntime();
                        process = rt.exec(command);     
                        exitCode = process.waitFor(); //wait until system command returnsand suddenly the progressbar doesn't proceed but pops up at the and of the complete loop. First i thought it is a refresh problem of the progressbar, but after i insertet System.out, these System.outs within the loop also only get printed (all but the very first) at the end of the loop. Toggling between the execution tasks "Thread.sleep" and "Runtime.exec" also toggles "nice progress output" and "output all at the end of the loop".
    I wonder why this happens?

    At least, i can workaround this because my system command throwed an IOException. With the correct command, it worked. But the effect still occurs, because I added a System.out in the catch clause and when using the wrong command (that cause the IOException), even those System.outs were printed in a batch way (all at wants) after all tasks finsihed. System.out.flush() didn't make any difference.

  • Can't redirect the Runtime exec output

    I'm trying to get mysqldump to give me some output which I can redirect to the tmp1 location
                   String tmp2 = "mysqldump";
                   Runtime rt1 = Runtime.getRuntime();
                   if(File.separatorChar == '\\') {
                        tmp2 = "\"C:\\Program Files\\MySQL\\MySQL Server 5.0\\bin\\mysqldump\"";
                   tmp1 = tmp2 + " > " + tmp1;
                   rt1.exec(tmp1);All I want to see at this point is just the error message telling me how to use mysqldump.
    After that I'll do something useful.
    I'm running under NetBeans and if I don't try to redirect I get nothing in the output window.
    Of course, if I run it from a Command box, I see the expected output.
    I know I'm running the program because if I change it to the nonsense mysqldump3, it will tell me that it can't find the file.
    I can't figure out where the output is going and how to capture it.
    Any ideas would be appreciated.
    Ilan

    Ilan wrote:
    Hi Sabre,
    Since I didn't understand your code, I'll use it as a chance to learn something.
    I don't understand what cmd.exe is doing. It is just opening a DOS box?No! It is interpreting the command string.
    Why do you need that? (Maybe I do and I don't know so....)You need to learn a good bit more about your operating system. Get a good book on Windows.
    >
    The simplest thing would be String command = "mysqldump > file.sql".
    Why shouldn't that work?1) Because the directory containing your mysqldump is not in the PATH.
    2) Because the redirection operator '>' is only applicable when interpreted by the command processor (cmd.exe). Reads your Windows manual.
    >
    The reason I need the explicit path is because mysqldump isn't on my Windows path (Linux is nicer that it is in usr/bin, so there is no problem.)
    So I detect Windows and for Windows put the path and command in quotes.
    (Now that I think about it, cmd.exe probably wouldn't work in Linux anyway.)On Linux you will need your shell to interpret the redirection operator '>' .
    >
    What is that "/C" all about? Go to drive c:?
    Your first attempt looks like a confusion with mysqldump, once without a path followed by a path.
    That one I don't understand at all.
    How do I go about getting control of the stderr, if I don't already have control?
    BTW, I haven't yet tried it in Linux. First I'll get the Windows version going.
    Thanks for your reply. I'll try to learn from it.You need to read, read again, study and then implement the recommendations in http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html .
    Sorry if this sounds like I'm passing the buck but your lack of knowledge of Windows, Linux and Runtime.exec() means I cannot help without writing a large tutorial.

  • How can i compile a C program to run solaris 9 and 10?

    Hi,
    I need to compile a small C program to run on solaris 9 and 10. There is no C compiler on the target servers. I have compiled and tested the program on Linux over x86.
    I hope you can advise on the way forward. I see the following options:
    - install a C compiler, the lightest possible, on the target servers and compile the program
    or
    - set-up a sparc solaris (9 or 10) on top of virtualbox on my windows laptop, install the c compiler and then compile the program
    Thanks in advance.
    Gaby

    To run an application on both Solaris 9 and 10, you need to build it on Solaris 9. The application will then run on Solaris 9 and 10. (If you build on Solaris 10, you cannot expect the application to work on 9.)
    The most recent Studio version that can be run on Solaris 9 is Studio 12 (but not updates 1, 2, or 3).
    You can still get Studio 12 here, but since it dates from 2007, I don't know for how much longer.
    http://www.oracle.com/technetwork/server-storage/solarisstudio/downloads/ss12-136026.html
    Studio does not do cross-compilation, so you need to build on a system of the same type as the target system -- SPARC or x86. I don't know whether Solaris 9 can be installed on Virtual Box, but you can try. If it works, you can install the compiler, build on that system, then deploy on other Solaris 9 and 10 x86 systems.
    You can of course build the application on each of Solaris 9 and 10, but usually that is not necessary, and it complicates deployment and support.
    I believe Solaris 9 is End Of Life, so it would be a good idea to upgrade S9 systems to S10 or S11. I realize that such a change might not be up to you. :-)

  • Provisioning multiple Solaris servers, need consistient uid

    I will be provisioning users to a number of Solaris servers using Identity Manager. However in order to accomodate some internal applications the user must have the same numeric uid for a particular user on all Solaris servers. The only way I can think of doing this is to create a database table and whenever I create a new user get the next value and use that as the uid.
    Anyone else with any suggestions on how to do this? I would have liked to have the first server in the provisioning order simply assign the uid and then use that same uid for the other servres, but I can't find a way to use a value from one provisioned server on another server when they're both being provisioned in the same Identity Manager Save operation.

    We had some help setting this up .. this is a rule which returns a unique uid:
    <Rule name='UidDBRule' createDate='1195697964630' lastModifier='Configurator' lastModDate='1195701542165' lastMod='26'>
        <block>
            <defvar name='value'/>
            <defvar name='type'>
                <s>mysql</s>
            </defvar>
            <defvar name='driverClass'>
                <s>org.gjt.mm.mysql.Driver</s>
            </defvar>
            <defvar name='url'>
                <s>jdbc:mysql://%h:%p/%d</s>
            </defvar>
            <defvar name='host'>
                <s>localhost</s>
            </defvar>
            <defvar name='port'>
                <s>3306</s>
            </defvar>
            <defvar name='db'>
                <s>dbname ..</s>
            </defvar>
            <defvar name='userName'>
                <s>dbuser ..</s>
            </defvar>
            <defvar name='passwd'>
                <s>dbpass ..</s>
            </defvar>
            <setvar name='value'>
                <add>
                    <invoke name='queryString' class='com.waveset.util.JdbcUtil'>
                        <map>
                            <s>type</s>
                            <ref>type</ref>
                            <s>driverClass</s>
                            <ref>driverClass</ref>
                            <s>url</s>
                            <ref>url</ref>
                            <s>host</s>
                            <ref>host</ref>
                            <s>port</s>
                            <ref>port</ref>
                            <s>database</s>
                            <ref>db</ref>
                            <s>user</s>
                            <ref>userName</ref>
                            <s>password</s>
                            <ref>passwd</ref>
                            <s>sql</s>
                            <s>Select uidNumber from user</s>
                        </map>
                    </invoke>
                    <s>1</s>
                </add>
            </setvar>
            <invoke name='sql' class='com.waveset.util.JdbcUtil'>
                <map>
                    <s>type</s>
                    <ref>type</ref>
                    <s>driverClass</s>
                    <ref>driverClass</ref>
                    <s>url</s>
                    <ref>url</ref>
                    <s>host</s>
                    <ref>host</ref>
                    <s>port</s>
                    <ref>port</ref>
                    <s>database</s>
                    <ref>db</ref>
                    <s>user</s>
                    <ref>userName</ref>
                    <s>password</s>
                    <ref>passwd</ref>
                    <s>sql</s>
                    <concat>
                        <s>update user set uidNumber=</s>
                        <ref>value</ref>
                    </concat>
                </map>
            </invoke>
            <ref>value</ref>
        </block>
        <MemberObjectGroups>
            <ObjectRef type='ObjectGroup' id='#ID#Top' name='Top'/>
        </MemberObjectGroups>
    </Rule>The dbtable has one single attribute, called uidNumber, and I initially set it to 15000, to make sure that sim-users would not get uidnumbers allready in use on our redhat servers.
    I ended up using the rule in the Redhat Linux User Form, like this:
          <Field name='global.unixId'>
            <Display class='Label'>
              <Property name='title' value='unixId: '/>
            </Display>
            <Default>
              <rule name='UidDBRule'/>
            </Default>
          </Field>

  • SharePoint Foundation 2013 - Search Configuration Issue - 2 App Servers and 2 Front-End Servers

    Hi, 
    We have a SharePoint Foundation 2013 with SP1 Environment. 
    In that, we have 2 Front-End Servers and 2 App Servers. In the Front-End Servers, the Search Service is stopped and is in Disabled state and in the 2 App Servers in One App Server, Search is Online and in another Search is Starting but goes to Stopped sooon
    after.
    Originally, we had only 1 App Server and we were running our Search Service and Search Service Application in that. Now since the index location became full and we were unable to increase the drive there, we added one more App Server and now the issue is
    Search is not properly getting configured in either of these App servers. What we want to do is run Search only in the new App Server, because we have a lot of storage space for Index locations here, but in the older App Server, not run Search at all.  We
    tried keeping the Search Service disabled and ran the below PowerShell Scripts, but none of the ones are working. These scripts are creating the Search Service Application, but the error of "Admin Component is not Online", "Could not connect
    to the machine hosting SharePoint 2013 admin component" is coming up. 
    http://www.funwithsharepoint.com/provision-search-for-sharepoint-foundation-2013-using-powershell-with-clean-db-names/
    http://blog.falchionconsulting.com/index.php/2013/02/provisioning-search-on-sharepoint-2013-foundation-using-powershell/
    http://blog.ciaops.com/2012/12/search-service-on-foundation-2013.html
    Can I get some help please?
    Karthick S

    Hi Karthick,
    For your issue, could you provide the
    detail error message of ULS log  to determine the exact cause of the error?
    For SharePoint 2013, by default, ULS log is at      
    C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\LOGS
    For troubleshooting your issue,  you can try to run the SharePoint Products Configuration Wizard on your WFE servers and run the script for configuring the search service on SharePoint
    Foundation:
    [string]$farmAcct = "DOMAIN\service_Account"
    [string]$serviceAppName = "Search Service Application"
    Function WriteLine
    Write-Host -ForegroundColor White "--------------------------------------------------------------"
    Function ActivateAndConfigureSearchService
    Try
    # Based on this script : http://blog.falchionconsulting.com/index.php/2013/02/provisioning-search-on-sharepoint-2013-foundation-using-powershell/
    Write-Host -ForegroundColor White " --> Configure the SharePoint Foundation Search Service -", $env:computername
    Start-SPEnterpriseSearchServiceInstance $env:computername
    Start-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance $env:computername
    $appPool = Get-SPManagedAccount -Identity $farmAcct
    New-SPServiceApplicationPool -Name SeachApplication_AppPool -Account $appPool -Verbose
    $saAppPool = Get-SPServiceApplicationPool -Identity SeachApplication_AppPool
    $svcPool = $saAppPool
    $adminPool = $saAppPool
    $searchServiceInstance = Get-SPEnterpriseSearchServiceInstance $env:computername
    $searchService = $searchServiceInstance.Service
    $bindings = @("InvokeMethod", "NonPublic", "Instance")
    $types = @([string],
    [Type],
    [Microsoft.SharePoint.Administration.SPIisWebServiceApplicationPool],
    [Microsoft.SharePoint.Administration.SPIisWebServiceApplicationPool])
    $values = @($serviceAppName,
    [Microsoft.Office.Server.Search.Administration.SearchServiceApplication],
    [Microsoft.SharePoint.Administration.SPIisWebServiceApplicationPool]$svcPool,
    [Microsoft.SharePoint.Administration.SPIisWebServiceApplicationPool]$adminPool)
    $methodInfo = $searchService.GetType().GetMethod("CreateApplicationWithDefaultTopology", $bindings, $null, $types, $null)
    $searchServiceApp = $methodInfo.Invoke($searchService, $values)
    $searchProxy = New-SPEnterpriseSearchServiceApplicationProxy -Name "$serviceAppName - Proxy" -SearchApplication $searchServiceApp
    $searchServiceApp.Provision()
    catch [system.exception]
    Write-Host -ForegroundColor Yellow " ->> Activate And Configure Search Service caught a system exception"
    Write-Host -ForegroundColor Red "Exception Message:", $_.Exception.ToString()
    finally
    WriteLine
    ActivateAndConfigureSearchService
    Reference:
    https://sharepointpsscripts.codeplex.com/releases/view/112556
    Thanks,
    Eric
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected].
    Eric Tao
    TechNet Community Support

  • Using Runtime exec() to open and close process like java or javac

    Hi, I m a student who is learning IT and is wondering if
    Runtime exec() can run and stop commands like java and javac?
    Can someone post the code to do so here?Thank you

    Well, Here is my complete code:
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    class StreamGobbler extends Thread
    InputStream is;
    String type;
    StreamGobbler(InputStream is, String type)
    this.is = is;
    this.type = type;
    public void run()
    try
    InputStreamReader isr = new InputStreamReader(is);
    BufferedReader br = new BufferedReader(isr);
    String line=null;
    while ( (line = br.readLine()) != null)
    System.out.println(type + ">" + line);
    } catch (IOException ioe)
    ioe.printStackTrace();
    class Program implements Runnable
         Process proc;
    String args[];
         String[] cmd = new String[4];
         boolean isGone=false;
         public Program(String args[])
              this.args=args;
         public void run()
              if (isGone==true)
                   try
                        Runtime.getRuntime().exec(cmd).destroy();
                   catch(IOException e)
                        System.out.println("Error: "+e.toString());
                   System.out.println("User abort");
         public void start(String args[])
              if (args.length < 1)
    System.out.println("USAGE: java GoodWindowsExec <cmd>");
    System.exit(1);
    try
    String osName = System.getProperty("os.name" );
    if( osName.equals( "Windows NT" ) )
    cmd[0] = "cmd.exe" ;
    cmd[1] = "/C" ;
    cmd[3] = args[0];
    else if( osName.equals( "Windows 95" ) ||osName.equals( "Windows 98" ))
    cmd[0] = "command.com" ;
    cmd[1] = "/C" ;
    cmd[2] = args[0];
                        cmd[3]=args[1];
    Runtime rt = Runtime.getRuntime();
    // System.out.println("Execing " + cmd[0] + " " + cmd[1]
    // + " " + cmd[2]+" "+args[1]);                                    
    proc = rt.exec(cmd);
    // any error message?
    StreamGobbler errorGobbler = new
    StreamGobbler(proc.getErrorStream(), "ERROR");
    // any output?
    StreamGobbler outputGobbler = new
    StreamGobbler(proc.getInputStream(), "OUTPUT");
    // kick them off
    errorGobbler.start();
    outputGobbler.start();
    // any error???
    // int exitVal = proc.waitFor();
    //System.out.println("ExitValue: " + exitVal);
    } catch (Throwable t)
    t.printStackTrace();
         public void destroy()
              isGone=true;
    class test1 implements ActionListener
         String s[]={"c:\\jdk1.3\\bin\\java.exe","ContactProcessor1"};
         GUI g=new GUI();
              Program p=new Program(s);
         public test1()
              //didnt work
              g.getStart().addActionListener(this);
              g.getStop().addActionListener(this);
              g.show();
         public void actionPerformed(ActionEvent e)
              if (e.getSource()==g.getStart())
                   p.start(s);
                   p.run();
              if (e.getSource()==g.getStop())
                   p.destroy();
                   p.run();
         public static void main(String args[])
              test1 t = new test1();
    class GUI extends JFrame
         JButton start;
         JButton stop;
         public GUI()
              super();
              getContentPane().setLayout(new FlowLayout());
              start=new JButton("start");
              stop=new JButton("stop");
              getContentPane().add(start);
              getContentPane().add(stop);
              setSize(100,100);
         public JButton getStart()
              return start;
         public JButton getStop()
              return stop;
    }

Maybe you are looking for