Cron can not start Java application as JAR file

Discussion in 'Java' started by Stefan Schulz, Dec 27, 2004.

  1. On Mon, 27 Dec 2004 10:57:05 +0100
    "Grzegorz Wrazen" <> wrote:

    > Hello
    >
    > I've a problem with cron and Java application.
    > Env: linux debian
    > I have installed jdk1.4 as local user in my home catalog.
    > When I try start simple class that is no problem, but
    > the problem is when I try start jar application
    > my script looks like:


    While this does not really belong here, check under which user cron runs
    the script. It looks as if the jar file somehow is unreachable.

    --
    In pioneer days they used oxen for heavy pulling, and when one ox
    couldn't budge a log, they didn't try to grow a larger ox. We shouldn't
    be trying for bigger computers, but for more systems of computers.
    --- Rear Admiral Grace Murray Hopper
     
    Stefan Schulz, Dec 27, 2004
    #1
    1. Advertising

  2. Hello

    I've a problem with cron and Java application.
    Env: linux debian
    I have installed jdk1.4 as local user in my home catalog.
    When I try start simple class that is no problem, but
    the problem is when I try start jar application
    my script looks like:

    #! /bin/bash

    PATH=${PATH}:"/home/grzegorz/jdk1.4/bin"
    export PATH
    java -jar -cp %CLASSHPATH%:/home/grzegorz/cron_test/ Test.jar >
    /home/grzegorz/cron_test/log.txt 2>/home/grzegorz/cron_test/errors.txt &

    and I got :
    Exception in thread "main" java.util.zip.ZipException: No such file or
    directory
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.<init>(ZipFile.java:112)
    at java.util.jar.JarFile.<init>(JarFile.java:117)
    at java.util.jar.JarFile.<init>(JarFile.java:55)

    Despite I check out permissions to this catalog, all seems to be fine.
    If I start this script manually everything is ok.
    What's the problem ?

    Regards GW
     
    Grzegorz Wrazen, Dec 27, 2004
    #2
    1. Advertising

  3. Uzytkownik "Stefan Schulz" <> napisal w wiadomosci
    news:20041227105430.69f6236c@localhost...
    > On Mon, 27 Dec 2004 10:57:05 +0100
    > "Grzegorz Wrazen" <> wrote:
    >
    > > Hello
    > >
    > > I've a problem with cron and Java application.
    > > Env: linux debian
    > > I have installed jdk1.4 as local user in my home catalog.
    > > When I try start simple class that is no problem, but
    > > the problem is when I try start jar application
    > > my script looks like:


    > While this does not really belong here, check under which user cron runs
    > the script. It looks as if the jar file somehow is unreachable.


    Yes, I agree with You but I dont know what is the reason ?

    Jar is generated by Eclipse



    > --
    > In pioneer days they used oxen for heavy pulling, and when one ox
    > couldn't budge a log, they didn't try to grow a larger ox. We shouldn't
    > be trying for bigger computers, but for more systems of computers.
    > --- Rear Admiral Grace Murray Hopper
     
    Grzegorz Wrazen, Dec 27, 2004
    #3
  4. Stefan Schulz

    ByteCoder Guest

    Grzegorz Wrazen wrote:
    > Uzytkownik "Stefan Schulz" <> napisal w wiadomosci
    > news:20041227105430.69f6236c@localhost...
    >
    >>On Mon, 27 Dec 2004 10:57:05 +0100
    >>"Grzegorz Wrazen" <> wrote:
    >>
    >>
    >>>Hello
    >>>
    >>>I've a problem with cron and Java application.
    >>>Env: linux debian
    >>>I have installed jdk1.4 as local user in my home catalog.
    >>>When I try start simple class that is no problem, but
    >>>the problem is when I try start jar application
    >>>my script looks like:

    >
    >
    >>While this does not really belong here, check under which user cron runs
    >>the script. It looks as if the jar file somehow is unreachable.

    >
    >
    > Yes, I agree with You but I dont know what is the reason ?
    >
    > Jar is generated by Eclipse


    What he means is that the linux user that should run your JAR-file may
    not access the directory, so you see an error.

    --
    -------------
    - ByteCoder - ...I see stupid people
    -------------
    Curiosity *Skilled* the cat
     
    ByteCoder, Dec 27, 2004
    #4
  5. Grzegorz Wrazen wrote:
    >
    > Hello
    >
    > I've a problem with cron and Java application.
    > Env: linux debian
    > I have installed jdk1.4 as local user in my home catalog.
    > When I try start simple class that is no problem, but
    > the problem is when I try start jar application
    > my script looks like:
    >
    > #! /bin/bash
    >
    > PATH=${PATH}:"/home/grzegorz/jdk1.4/bin"
    > export PATH
    > java -jar -cp %CLASSHPATH%:/home/grzegorz/cron_test/ Test.jar >
    > /home/grzegorz/cron_test/log.txt 2>/home/grzegorz/cron_test/errors.txt &


    Remove the '-cp' following the -jar toggle and the spaces before Test.jar. -jar must be
    followed by the filename (with path) of a jar file. Also note that -cp will be ignored
    when using -jar. Check the docs.

    --
    Lee Fesperman, FFE Software, Inc. (http://www.firstsql.com)
    ==============================================================
    * The Ultimate DBMS is here!
    * FirstSQL/J Object/Relational DBMS (http://www.firstsql.com)
     
    Lee Fesperman, Dec 27, 2004
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Arnold Peters
    Replies:
    0
    Views:
    637
    Arnold Peters
    Jan 5, 2005
  2. muttley
    Replies:
    0
    Views:
    2,798
    muttley
    Oct 20, 2005
  3. cyberco
    Replies:
    4
    Views:
    3,876
    Roedy Green
    Feb 14, 2006
  4. Arnold Peters
    Replies:
    0
    Views:
    705
    Arnold Peters
    Jan 5, 2005
  5. PHP2
    Replies:
    9
    Views:
    328
Loading...

Share This Page