Results 1 to 6 of 6
  1. #1
    sashaxiv is offline Member
    Join Date
    Feb 2011
    Location
    Spain
    Posts
    26
    Rep Power
    0

    Default Running .jar as windows task

    HI all,
    I have encountered a problem running a .jar as a windows task in Windows Server 2008.

    It worked properly with WinXp but now I am getting next error with Server 2008 (I've already checked the path)

    Java Code:
    java.io.FileNotFoundException: C:\Windows\system32\src\view\img\logoletrasyfondo.jpg (The system cannot find the path specified)
    	at java.io.FileInputStream.open(Native Method)
    	at java.io.FileInputStream.<init>(Unknown Source)
    	at java.io.FileInputStream.<init>(Unknown Source)
    	at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
    	at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
    	at java.net.URL.openStream(Unknown Source)
    	at com.itextpdf.text.Image.getInstance(Image.java:243)
    	at com.itextpdf.text.Image.getInstance(Image.java:339)
    	at facade.ventasGlobal.pdf.PdfVentasGlobalCadenas.addHeaderTable(PdfVentasGlobalCadenas.java:968)
    	at facade.ventasGlobal.pdf.PdfVentasGlobalCadenas.generaInformePdf(PdfVentasGlobalCadenas.java:78)
    	at facade.ventasGlobal.FacadeVentasGlobalCadenas.generaInformeVentasGlobalCadenas(FacadeVentasGlobalCadenas.java:92)
    	at task.TaskDiaria.main(TaskDiaria.java:92)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    	at java.lang.reflect.Method.invoke(Unknown Source)
    	at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    	at java.lang.reflect.Method.invoke(Unknown Source)
    	at com.ucware.JEXEClassLoader.run(Unknown Source)
    	at com.ucware.JEXEClassLoader.main(Unknown Source)
    any ideas?

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,949
    Rep Power
    19

    Default Re: Running .jar as windows task

    That file doesn't exist?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #3
    sashaxiv is offline Member
    Join Date
    Feb 2011
    Location
    Spain
    Posts
    26
    Rep Power
    0

    Default Re: Running .jar as windows task

    The file exists.

    If I copy the path of the file and I paste it at the file explorer, the file opens properly.

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,949
    Rep Power
    19

    Default Re: Running .jar as windows task

    Check the ownership and privileges.
    A service doesn't have many.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    sashaxiv is offline Member
    Join Date
    Feb 2011
    Location
    Spain
    Posts
    26
    Rep Power
    0

    Default Re: Running .jar as windows task

    The problem is while WinXP runs the task in the same folder as the .jar is located, Win2008Server runs the task in System32.
    The user who is running the task is an admin and it has all privileges available.

    I can't undestand

  6. #6
    sashaxiv is offline Member
    Join Date
    Feb 2011
    Location
    Spain
    Posts
    26
    Rep Power
    0

    Default Re: Running .jar as windows task

    It was due to relative paths in the code.
    Win2008Server looks for the files in a different way.

    Changing the relative paths to absolute, it worked.

Similar Threads

  1. Running Jar files in Windows
    By GRP in forum New To Java
    Replies: 5
    Last Post: 08-07-2012, 09:39 AM
  2. whats the deal with windows 7 task scheduler?
    By dhazwa in forum New To Java
    Replies: 3
    Last Post: 07-26-2011, 10:58 AM
  3. running java under Windows 7
    By newbie123 in forum New To Java
    Replies: 3
    Last Post: 05-29-2010, 08:36 PM
  4. getting running application from task manager
    By gayathri_g in forum Threads and Synchronization
    Replies: 3
    Last Post: 09-26-2009, 06:43 PM
  5. Replies: 0
    Last Post: 04-12-2009, 04:16 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •