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.

Similar Messages

  • How do i run a java application in jdk1.3

    im trying to run a java application in jdk 1.3. I created it in jbuilder and i was trying to use the applet viewer.

    http://java.sun.com/j2se/1.3/docs/tooldocs/win32/appletviewer.html
    Jesper

  • How can I run a java-application on starting of Windows 2000

    How can I run a java-application without any user on starting of Windows 2000?
    For example, if the computer is restarted and nobody enter into it yet, my java-application should run anyway.
    How can I do that?

    Hi, you have to put it in a Windows service.
    To do this you have a program, Srvany.exe that allow to insert a .exe or .bat program in a Windows service.
    For example, i develop a program, TomcatGuardian and i put it in a service because i need to run it in a server without Administrator logged in.
    Regards,
    Ivan.

  • Running a java application from a java application

    hello ,
    please who knows how i can run a java application 'B' from inside another java application 'A' and get the error messages (if any) from the application 'B'

    how are you executing application B from application A? Please explain the java code you are using?

  • Running a Java application from a Swing GUI

    Hi,
    I was wondering if there is a simple way to run a Java application from a GUI built with Swing. I would presume there would be, because the Swing GUI is a Java application itself, technically.
    So, I want a user to click a button on my GUI, and then have another Java application, which is in the same package with the same classpaths and stuff, run.
    Is there a simple way to do this? Do any tutorials exist on this? If someone could give me any advice, or even a simple "yes this is possible, and it is simple" or "this is possible, but difficult" or "no this is not possible" answer, I would appreciate it. If anyone needs more information, I'll be happy to provide it.
    Thanks,
    Dan

    I don't know if it is possible to run the main method from another Java app by simply calling it...
    But you could just copy and paste the stuff from your main method into a new static method called something like runDBQuery and have all the execution run from there.
    How does that sound? Is it possible?
    What I'm suggeting is:
    Original
    public class DBQuery{
    public static void methodA(){
    public static void doQuery(){
    methodA();
    public static void main(String[] args){
    // Your method calls
    //Your initializing
    doQuery();
    }Revised:
    public class DBQuery{
    public static void methodA(){
    public static void doQuery(){
    methodA();
    public static void doMyQuery(){
    // Your method calls
    //Your initializing
    doQuery();
    // No main needed!!
    //public static void main(String[] args){
    // Your method calls
    //doQuery();
    //}

  • Running a java application in command prompt

    hi, I'm new to this forum.
    I would like to know what exactly needs to be specified to run a java application in a normal DOS command prompt.
    I know it is something like:
    javaw -classpath .\class GUI.applicationGUI
    where applicationGUI is the main class, right? What else do I need to do, since I have some other non-GUI classes that I need, inside the class folder ?
    Thanks for your time.

    You need to import those classes. And you need to make packages.
    In classes 1, 2 and 3 put:
    package class;
    In class 4 put;
    package class.GUI;
    Then you need to make the connection:
    In classes 1,2 and 3 put:
    import class.GUI.*;
    In class 4 put:
    import class.*;
    Compile each directory separately while in the respective directory. javac *.java
    Then go back to the directory above the directory "class" and run
    java class/GUI/name_of_file_containing_main_method

  • Is it possible to run a java application within a web browser?

    Hello everyone here! I have a question about running a java application within a web browser and I would appreciate it very much if anyone here can give me some answers.
    I have a standalone java application written with AWT. Basically this free application lets users to select spectral lines from a big file based on some criteria and plot those selected lines. Yes, it is a very simple application. Now I want to run this application within a web browser so that users don't need to download the application from the ftp site and thus don't need to install in their machine. Is it possible to run this application within browser? If yes, can we get the same plotting function as we run the application separately and where should I start out?
    Thanks in advance!
    kuilian

    Please see the signed applet discussion group for details of how to avoid the applet security restrictions. You can sign the applet, or use the policy file containing {AllPermission} for testing purposes (though not suitable for widespread deployment).
    Regards
    Matthew

  • Can we run a java application using Runtime.exec()?

    Can we run a java application using Runtime.exec()?
    If yes what should i use "java" or "javaw", and which way?
    r.exec("java","xyz.class");

    The best way to run the java application would be to dynamiically load it within the same JVM. Look thru the class "ClassLoader" and the "Class", "Method" etc...clases.
    The problem with exec is that it starts another JVM and moreover you dont have the interface where you can throw the Output directly.(indirectly it can be done by openong InputStreams bala blah............). I found this convenient. I am attaching part of my code for easy refernce.
    HIH
    ClassLoader cl = null;
    Class c = null;
    Class cArr[] ;
    Method md = null;
    Object mArr[];
    cl = ClassLoader.getSystemClassLoader();
    try{
         c = cl.loadClass(progName.substring(0,progName.indexOf(".class")) );
    } catch(ClassNotFoundException e) {
    System.out.println(e);
         cArr = new Class[1] ;
         try{
         cArr[0] = Class.forName("java.lang.Object");
         } catch(ClassNotFoundException e) {
         System.out.println(e);
         mArr = new Object[1];
         try{
         md = c.getMethod("processPkt", cArr);
         } catch(NoSuchMethodException e) {
         System.out.println(e);
         } catch(SecurityException e) {
         System.out.println(e);
    try {            
    processedPkt = md.invoke( null, mArr) ;
    } catch(IllegalAccessException e) {
              System.out.println(e);
    } catch(IllegalArgumentException e) {
              System.out.println(e);
    }catch(InvocationTargetException e) {
              System.out.println(e);
    }catch(NullPointerException e) {
              System.out.println(e);
    }catch(ExceptionInInitializerError e) {
              System.out.println(e);
    }

  • Proble regarding running a java application

    hi guys
    i'm new to java environment .
    when i'm running a java application in a console ,
    it is not able to give output in other directories.it is working only in c:\j2sdk\bin.
    i think its the problem of setting classpath.
    can any one help me hw to run java program in any folder.

    You need to add that directory to your PATH. Follow
    the installation instructions more completely.Howdy sheriff Warnerja! How's life in the Schmuckville Home of the Ball-less? Any leads regarding the dot flasher case? I see you're on the PATH.
    Sheriff Warnerja of Schmuckville sensed an indecency plot.
    Here was someone exposing her private dot.
    He went on the trail,
    but of no avail:
    He didn't know where to find that intimate spot!

  • Running a Java Application in Windows

    Hi, Can anyone tell me how to run a Java Application in Windows? I've tried to run it using TextPad 4.5 but it gives me an exception saying it can't find a class defenition. I'm actually using IBM VisualAge for Java to develop the app and it runs fine INSIDE VisualAge and I've exported my compiled class files and so on, to run it stand-alone in Windows. I'm using some custom objects and inner classes, could these be the problem?

    YES! SUCCESS! I exported my class files from VAJ and along with the manifest file that it adds automatically. I opened up the jar with Winrar, extracted the manifest file and added the Main-class: header pointing to my executable and then put it back in the jar with winrar. And PRESTO! I can now run it with javaw! Thanks for your help peeps...

  • I want to run a java application once only.Pl help.

    i want to run a java application once only.
    i.e. if some application is running on Win NT OS then that
    particular appliaction again should not run,but other java application can run.
    Pl help with some sample code.
    Thanx.

    Hi,
    I if understood your question then your requirement is to run the application when the system is on.If this is the case then you can configure your OS schdular to do the job an let the OS do it.You can
    write the java code for this but that will require to run on the OS layer,so better to configure the schedular setting.....But then for some other requirement it cannot be useful....
    think...
    regards vicky

  • 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

  • How to constant running a java application

    I have created a java application. My main class is called PTS.class and that has my main method.
    I wish to run this class continously, such that each time the main method completes execution, it is called again.
    I could probably do that by creating a thread which runs infinitely, as below. Is this a good skeleton solution? Will each instance of class PTS be garbage collected after execution, before a new one is created?
    Is there any freeware Java scheduler out there that allows me to do the same thing i.e. running an application infinitely?
    public class TestApplication implements Runnable{
    p.s.v.m (String[] args){
    Thread t = new Thread(this);
    t.start();
    public void run(){
    while(true){
    PTS pts = new PTS();
    }

    I'm not aware of any general Java based scheduling applications, though there certainly may be some. In general schedulers are built into the O/S such as cron. More robust schedulers like AutoSys are native code in part because they need to do O/S specific things like change who a particular process is running as.
    Depending on your needs it shouldn't be too bad to write your own.

  • Running a Java Application on a Novell Netware Server

    I know this is a strange question but I was hopeing someone could help me or point me in the right direction. I have a java application that backs up files. I would like to run it automatically at night on our Novell server. Can Java run on a Novell OS. Any advice is appriciated.

    See http://www.javaworld.com/javaworld/jw-04-1998/jw-04-netware5.html

  • Running a Java application from web browser

    Hi,
    I'm not sure if this is the right place to put this, and it probably isn't, but I don't really know what else to do at the moment.
    I have a problem. I've written all these nice and pretty Java applications that do all this complicated junk that makes me proud. However...I have no idea how to actually run those applications.
    I've looked at guides on Java applets, Java Web Start, Java Server Pages, etc, and I still am not sure. JSP looked like the best option, until I figured out I can't use it with my web server. So, I've pretty much hit a wall here.
    If anyone could shed some light on this, I would be very appreciative. All I want is for a certain application to run when a user clicks a button on a simple HTML page. That's all I want...yet it seems so hard.
    Is there a simple way to do this, or do I need to use JWS or something and configure all these JARs and JNLP and classpaths and everything under the sun (no pun intended)?
    Again, I apologize if there is a better forum for this; I am just very confused right now and feel like I've hit a brick wall. If anyone can give me any advice, or point me in a good (easy) direction, I would truly be grateful.

    If anyone could shed some light on this, I would be
    very appreciative. All I want is for a certain
    application to run when a user clicks a button on a
    simple HTML page. That's all I want...yet it seems so
    hard. There's a lot of hidden details that make it so hard. What computer will run the application when the button is clicked? If the application will run on the client computer (within the web browser) there has to be a mechanism for allowing arbitrary code to be downloaded, verified and executed on any number of different target platforms. This is the problem that Java Applets address. Mostly this is a security issue, since a simple HTML page being able to run arbitary code without user interaction or approval is going to cause the world to be overrun by computer virii. There's also the multi-platform issue, but in many cases that can be avoided by requiring the client to use a single platform (the MS approach).
    If the application will run on the server, then the client code is much less difficult, as only a basic web browser is needed, and the server code is complicated, since it needs to keep track of multiple clients at the same time and process data in a request-response fashion.
    From the end-user's point-of-view, it certainly is simple though. Press the button and voila!
    "Any technology which is distinguishable from magic is insufficiently advanced"
    Brian

Maybe you are looking for

  • Word closses and give error after making a pdf with Adobe Acrobat 9 Pro Extended

    Dear, Everytime i use Adobe Acrobat 9 Pro Extended i get the error: "Windows cannot open the file ~ WRS{E488CD etc /OEF}. If the file is stored on your computer there might be a problem with your hardware. If the file is stored on your network ..." f

  • Project link does not work in Office 365

    We recently signed up for Office 365 and Project Online.  That adds a link "Projects" in the top nav, but when I click on it, I get error "Sorry, this site isn't available right now. Give us few minutes and try again. If it still does not work, conta

  • Zooming in on portion of clip (person) smoothly?

    As most of you know already I am working on a highlight video for a college football player.  I am trying to zoom in on this player at the end of a particular play - when the camera actually follows a different player in the opposite direction. I sea

  • OBIEE 10G count distinct problem

    Hi, I am really new to OBI now runs into this problem. I have a fact and three dimension tables as follows: fact: 1. sales: sold_vlaue (sum) transactions (count distinct receipt_id) branch_id (foreign key) daykey (foreign key) receipt_id (foreign key

  • Oracle Text License

    Hi All, Does anyone know if Oracle Text requires a separate license purchase for 8i EE and 9i EE? It is stated that Oracle Text is part of 9i enterprise and standard editions on the FAQ site. http://otn.oracle.com/products/text/x/FAQs/imt_Faq.html Ho