JAVA application on a UNIX platform

I've stripped my code to the very simplest form and I can not fix this strange behaviour I'm getting when I run it on a UNIX machine. Both Linux and Windows work fine. Simply put this code initializes a File object corresponding to a directory on the user machine:
File dir = new File("/usr/local"); I then query the directory for all Files every couple seconds and print them out
while(x < 0) {//infinite loop
  list = dir.listFiles();
  for (int y =0; y<=list.length-1; y++{
    System.out.println(list[x].toString());
  thread.slepp(1000);
} The problem on the UNIX platform is that once the number of file reaches about 82, sometime 83, sometimes 84, it stops seeing all files. Comes up empty. This behaviour is not seen with Linux or Windows, I have listed up to 2500 files on those platforms. Any ideas?
BTW I'm using a SUN running Solaris

Well, is there any problem with your Solaris installation?
if you could run a script like this for a few minutes: (sorry, I have no access to a Solaris machine now in order to test this script, but I think that you can read it and understand the idea:
while true
do
    ls -l /usr/local | wc -l
    sleep 1
donels -l /usr/local lists the files of /usr/local, and wc -l counts the lines of the listing.
It's approximately the equivalent of your Java program. If it gives strange results like your Java program, you can try making a backup of all your work that you've done in the Solaris machine, and ask for immediate maintenance.

Similar Messages

  • Running a JAVA application as a Unix Cron Job

    I'm trying to run a 3rd party java application on a Unix (Solaris) system. I want to run it from a script so that I can put it in the cron schedule. The problem is that it won't run as a pure batch script. It seems to really want a DISPLAY device assigned to the shell, even though it never displays anything to that device. The vendor claims that he is not using any DISPLAY functionality.
    Here's my script;
    #!/bin/sh
    # PARAMETER 1 (%1): name (without .tif)
    # PARAMETER 2 (%2): type (CAMS or MACS)
    # PARAMETER 3 (%3): level (1, 2, or 3)
    export myCP=./Extract.zip:lib/jai_codec.jar:lib/jai_core.jar:lib/mlibwrapper_jai.jar
    export DISPLAY=(some xhost unix workstation's IP address)
    java -classpath $myCP extract.ByteConvertOne $1 $2 $3 > byteconvertone.log 2>&1
    If I run this script with the "export DISPLAY" in place, it runs fine. If I comment out the "export DISPLAY" line, it hangs and will never execute or error out.
    Is there some other redirect, or system property setting I need to change to make this work?
    Help

    only idea is to set system wide the DISPLAY to :0
    for examples in
    /etc/profile :
    export DISPLAY=:0
    btw: AFAIK when you instantiate swing or awt classes they require an X server running and the DISPLAY variable to be set. Perhaps that is a clue, why you need this.

  • Starting and stopping applications via a Java-application on Windows/Unix

    Hello,
    I want to start java and other applications via a java application.
    This java application should start several different applications on windows and
    on unix systems and take care of their current state (e.g. running/not running).
    For all applications to be started there are .sh-scripts for unix and .bat-scripts
    for windows. In the scripts there could be a java call, e.g. "java someApplication",
    or some executables could be called. These scripts set the applications' environment etc.
    and start the application finally.
    My java application calls these scripts via the ProcessBuilder API, which is working fine.
    But there is the following problem: on windows, when executing a script that starts
    some other application, the ProcessBuilder gives me process-handle to the started
    process. If calling destroy() on this handle, only the cmd.exe gets killed which
    started the application. The application itself is running on. This is undesired behaviour
    since I want to be able to control the started applications, at least start and stop it which
    is impossible that way.
    On unix, it is working when using
    "exec java someApplication"
    instead of just
    "java someApplication"
    in the .sh-scripts. The exec command substitutes the shell process with the underlying
    process started in the script, so everything is working as expected on unix.
    But how could I get this working on windows systems? Is there any equivalent to the exec
    command on unix? Any suggestions appreciated.
    If something's unclear in my description, please let me know.

    Yes - after looking at this option - I think that's the direction I am going to go. It probably makes sense to give my JMS topics and my BPEL server their own OC4J instances anyway - for a number of reasons.
    Lon

  • Headless Installer for AIR Application on Linux/Unix Platforms

    Is there a way to install Adobe AIR applications without invoking the GUI wizard that walks through the step-by-step process? I have an AIR application that needs to be remotely deployed on a device (that's running Linux) from a terminal session (sometimes using a scheduled job run by a script) . Its a trusted environment and deployments are all within a single enterprise. Is it possible to automate the process of accepting a self-signed certificate and specify installation path as arguments to a command line installer? I played around a bit with the installer script but it seems to invoke the standard interactive GUI every time and that wouldn't work for my case. Any help is greatly appreciated.

    I am not sure about Linux platform but I have experience running headless installation for Mac OS X .
    The command I execute is:
    Adobe\ AIR\ Installer.app/Contents/MacOS/Adobe\ AIR\ Installer -silent -location /Applications SPS.air
    If you are distributing the Air Runtime to clients, there is a license agreement you need to complete with Adobe. More here:
    http://www.adobe.com/devnet/air/articles/distributing_air_in_enterprise.html

  • Building and Deploying Java applications in different platform (OS)

    Hi all,
    We currently have a J2EE based web services application that is built (compiled) and deployed on Windows 2000 Advanced server. But in future, we will be using WIndows 2000 server for development only and HP-UX for production.
    So, we are planning on executing the build (compilation) of our application on Windows 2000 server and deploy the same binaries (WAR) on HP-UX also. So, I wanted to know anyone has faced issues in the past by deploying an application on a different platform than the one on which it was compiled. Is it recommended by SUN to compile and build Java applications on the same platform on which the application is deployed.
    Note that in my case, the JVM versions between Windows server and HP-UX would be the same. But the JVM for Windows server has been provided by Sun and the JVM for HP-UX has been provided by HP-UX.
    Your inputs are greatly appreciated.

    Well, it's all Java, right? So what's the problem? Since the JVM for HP-UX isn't made by Sun, so there could be compatibility problems, but I would expect that would be minimal if a problem at all. But you can't know unless you run it.
    I don't know about building on the different systems. Java's supposed to be write once, run anywhere.... The byte code should be compatible no matter what. I've never heard of Sun saying "compile it on each platform". If the HP JVM isn't going to like bytecode compiled on Windows or another OS, then something isn't kosher with someone's JVM or compiler.

  • Steps involved in writing java application on win CE

    I want to develop a java application in win CE platform for a handheld device.
    1. What are all the steps involved.
    2. Is there any simulator available for win CE so that I can run my java application.
    Advance thanks,
    Regards,
    Balasubramaniam.K.R
    [email protected]

    The way I developed my first app for the Compaq iPAQ
    1. Install PersonalJava
    2. Build app using AWT classes only (although I think SWING can be used)
    3. Screen size 240 x 295 (thats what I used)
    4. Compile and run on PC
    5. Move to PPC (fingers crossed)
    6. You may want to add an app.LNK file (kinda like a *.bat file) to setup classpath and file args
    Sun has a compatibility suite you can run against your app to make sure it is PJava compliant. http://java.sun.com/products/personaljava/javacheck.html
    Also make sure you don't use classes/methods that aren't supported
    There is a PJava emulkation environment, but I never used it.
    http://java.sun.com/products/personaljava/pj-emulation.html
    ...good luck

  • File association on Windows for Java application?

    Sorry for the Windows-related question, but I thought maybe some fellow Java hackers had run into the same problem...
    We have a Java application targeted for multiple platforms, including Windows. We also have a certain file extension for our data files, call it .abc. Our customers would like the following functionality in Windows Explorer when the app is installed on Windows:
    1 - custom description for .abc files
    2 - custom icon for .abc files
    3 - double-click an .abc file to open it in our application
    It's easy enough to get this functionality by setting appropriate registry keys:
    HKEY_LOCAL_MACHINE\Software\Classes\.abc: @ = OurApplication.abc
    1 - HKEY_LOCAL_MACHINE\Software\Classes\OurApplication.abc: @ = An abc file for OurApplication
    2 - HKEY_LOCAL_MACHINE\Software\Classes\OurApplication.abc\DefaultIcon: @ = <path>\OurApplication.ico
    3 - HKEY_LOCAL_MACHINE\Software\Classes\OurApplication.abc\shell\open\command: @ = "<path>\OurApplication.exe" "%1"
    This works great, except you have to restart Windows to get the changes to take effect. Does anyone know how to get the Windows shell to update itself to reflect these new Registry keys without restarting Windows? I've seen the SHChangeNotify function, but I can't call Windows API functions easily from the installer.

    rundll32.exe may be of use...
    Here are some samples of how to use it: http://dev.remotenetworktechnology.com/cmd/rundll32.htm
    Google for more.
    - K

  • How to use Entrust with java application on unix platform

    Hi all,
    i have question regarding the use of Entrust with java application on unix
    1)I want to use Entrust for encryption/decryption of the file in my core java application on unix platform.
    What should be requiremnet for the same and how it is implemented?.
    2) I want to Use Entrust for Authentication purpose in my java based web application on unix platform.
    What are requirements for Entrust Authentication and how it is implemented ?

    any one has solution?

  • Urgent Help in java accross the UNIX platform

    If I develop an application using Java in SCO Unix, Is it possible to port the same application to HP Unix or AT & T Unix. Please kindly give me the infomation/details where it is available or how to do it. Need urgent
    Thanks in Advance
    Jyothi

    If I develop an application using Java in SCO Unix, Is
    it possible to port the same application to HP Unix or
    AT & T Unix.Should port with no changes.

  • Java application -  processing files on different unix server

    Hi,
    I was wondering if it is possible to
    a) read a file that is on a different unix server to the one that my java application is on
    b) move a file from one directory on the remote unix server to another directory on the remote unix server
    Regards,
    sabretooth

    for (b):
    If I were you I would set up a FTP account for your app on the remote unix server. Then I would get my hands on a simple ftp framework
    and simply:
    Ftp ftp = new Ftp("UNIXHostIP", username, password);
    ftp.connect();
    ftp.moveRemoteFile("form here","to here");
    ftp.disconnect();
    some frameworks:
    JScape, iNet Factory: com.jscape.inet.ftp.Ftp
    /n software, IP*Works: ipworks.Ftp
    Enterprise Distributed Technologies, Java FTP Client Library: com.enterprisedt.net.ftp.FTPClient
    IBM alphaWorks, FTP Bean Suite: com.ibm.network.ftp.protocol.FTPProtocol
    SourceForge, JFtp: net.sf.jftp.net.FtpConnection
    The Jakarta Project, Jakarta Commons/Net: org.apache.commons.net.ftp.FTPClient
    JavaShop JNetBeans: jshop.jnet.FTPClient
    Sun, JDK: sun.net.ftp.FtpClient
    Florent Cueto, JavaFTP API: com.cqs.ftp.FTP
    Bea Petrovicova, jFTP: cz.dhl.ftp.Ftp
    The Globus Project, Java CoG Kit: org.globus.io.ftp.FTPClient
    I recomend JScape's INetFactory (Easy to use)
    OR the one from Jakarta (Free)
    IP*Works (TOP Quality at a price)
    Check out http://www.javaworld.com/javaworld/jw-04-2003/jw-0404-ftp.html
    for a complete review of all the ftp frameworks
    Firewalls?
    make a folder that is public on the unix server-ie falls outside the firewall if there is one (fire walls might cause problems for you)
    Unless you know the password to get through the Proxy then this should not be a problem.

  • User Role problems in Sun Java Application Server Platform Edition 8

    I am having two problems setting up user roles in Sun Java Application Server Platform Edition 8. At first, I thought that it was a problem with the higher level features that I was using, so I created a very simple example using the simplest authentication I can use, but the problem still occurs. I am using the file realm and configuring the users in the App Server Admin Console. I create 2 users in different roles. One user should have access, the other should not.
    1) The first problem is that both users can access the page
    2) The second problem is that the isUserInRole() method returns false for both users with the role that it should be authenticating against.
    Here is a sample of my code:
    Users Configured in Console:
    username password roles
    user1 ********** admin
    user2 ********** noaccess
    web.xml
         <security-role>
              <role-name>admin</role-name>
         </security-role>
         <security-constraint>
              <web-resource-collection>
                   <web-resource-name>My Protected Area</web-resource-name>
                   <url-pattern>/*</url-pattern>
              </web-resource-collection>
              <auth-constraint>
                   <role-name>admin</role-name>
              </auth-constraint>
              <user-data-constraint>
                   <transport-guarantee>NONE</transport-guarantee>
              </user-data-constraint>
         </security-constraint>
         <login-config>
              <auth-method>BASIC</auth-method>
              <realm-name>file</realm-name>
         </login-config>
         <servlet>
              <servlet-name>
                   TestServlet
              </servlet-name>
              <servlet-class>
                   mypackage.TestServlet
              </servlet-class>
              <security-role-ref>
                   <role-name>admin</role-name>
                   <role-link>admin</role-link>
              </security-role-ref>
         </servlet>
         <servlet-mapping>
              <servlet-name>
                   TestServlet
              </servlet-name>
              <url-pattern>
                   /TestServlet
              </url-pattern>
         </servlet-mapping>
    TestServlet.java:
              out.println("admin role: " + request.isUserInRole("admin") + "<BR/>");
    Thanks before hand for any responses.
    - Brian

    Hi Jeanfrancois,
    Your suggestion has lead me to find my problem. There were actually three problems.
    1) First, you suggestion to reorder my xml file did not cause any errors to occur. I got suspicious that my web.xml file was wrong. I looked at some sample web-xml files and found that I was missing the header as follows:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' 'http://java.sun.com/dtd/web-app_2_3.dtd'>
    2) When I added this information, the deploy feature failed stating the my web.xml file was out of order. I fixed the ordering. It now deployed, but the security still wasn't working.
    3) I then added the sun-web.xml file. This file was missing before hand as I thought it was unnessary. However, this file added the essential mapping from a role to a group. After adding this, it now started to work.
    Thanks so much for you time and effort. You really did help me.
    - Brian Blank

  • How to find cd rom drive in windows and unix platform using java program

    Hi,
    I am having the requirement of finding the cd rom drive
    using java program. I do not know the label and which
    one is the cd rom drive. also I want to know how many
    cd rom drives are there on my system. I want the solution
    for windows and unix platforms.
    If have any suggestions please mail to [email protected]
    Deepak

    Ughhh.. I had the same problem with multi platform file-system detection
    First off - Unix.
    Do you know for sure you have all your drives mounted?? This could be a big problem because java will not see unmounted drives... So you can scour thru your /etc/fstab to find out which drives are available... or you can mount all and show roots... (Yuck!)... You've got timeouts and all sorts of things to worry about...
    I would then shy away from the java.io.File.listRoots() on unix and rely on parsing your fs file. If a user would like to see the medium in the drive. Do a Runtime.exec and mount the drive, then you can grab the filesystem by wrapping it in the java.io.File object. ( NOTE - this will hold well for your NFS mounts as well which might be buried under other FS. So you now have detection for that as well. ) Labels are also noted in this file. Let me know if you don't know the difference between mtab and fstab....
    Second - Winders.... Corney but I love saying that.
    The listRoots is a good solution. As others have said CD-ROMS will not be writable. Use a combination of getName and getPath to decipher the label and mount point.
    Hope this helps!

  • Using Unix commands from Java Application

    Hi,
    I need to write an Java application such that could run Unix commands in a Unix box.
    For example, my Java app needs to log in the Unix box, change directory (cd), create new folder (mkdir), list the current files in folder (ls), mount a new device (mount), etc.
    Thank you very much.
    Hung

    you can use java.lang.Runtime.exec to invoke OS commands, but if you're going to be completing a sequence that complicated and need to manage error handleing well, it might be best to just invoke a native method or write a shell script that does all of that stuff and then invoke that script via Runtime.exec . The Runtime class has limitations when you start invoking processes that require user input (like 'su'). Search the forums for more extensive examples on how to use Runtime.

  • Call a Java Application from MicroFocus COBOL (in UNIX environment)

    Hello,
    Could you please let me know, how to call a Java application from a MicroFocus COBOL application. If anyone has any code samples, that would be of great help.
    Thanks in advance,
    Tijo.

    You generally can't cause a program to be executed on a different >server. Basic security, you know. Besides this idea of having the Java >application run on a different server wasn't mentioned in your original >post. That leads me to believe we don't have the whole story.So I think you need to step back and find out what are the requirements. For example: Does your program need to start this Java application running, or is it already running and your program needs to connect to it somehow?
    My program has to start a Java class file, meaning that the Micro Focus COBOL module will call the Java class file. Will it be running on the same machine as your program, or on some other machine?
    For both cases, I would like to know the answer.a) Running on the same machine as my program is running.
    b) Running on the different machine.
    And then there are the questions about whether your program needs to have a conversation with the Java application, or whether it just needs to start it and that's all.
    COBOL program has to call a Java class by passing some parameters and Java class in turn process it and return some value back.. Kind of Request and Response model.Plenty of questions to be asked. Go and find out what they are.
    Sorry ... if I am not clear on my questions. Anyhow, thank you very much for providing the information.

  • Calling a Java Application from MicroFocus COBOL.... (in UNIX environment)

    Hello,
    Could you please let me know, how to call a Java application from a MicroFocus COBOL application. If anyone has any code samples, that would be of great help.
    Thanks in advance,
    Tijo.

    Annoyingly crossposted.
    http://forum.java.sun.com/thread.jspa?threadID=730657

Maybe you are looking for