Results 1 to 8 of 8
  1. #1
    Coold0wn is offline Member
    Join Date
    Aug 2011
    Posts
    71
    Rep Power
    0

    Default Creating .jar File - .jar doesnt do anything

    hey guys,
    i have a problem with the .jar file..
    if i run the void main(String args[]) method of my main class: Start everything is working fine , and i got my programm were i can click my buttons, load images etc.
    but when i create a .jar file , with Start class as main class, it takes a while until it's done and the .jar is at the folder i chose. but now if i click on the .jar... it loads for 1 sekond and then nothing happens...

    do you have any idea why this could be?...
    (i work with blueJ if that might be usefull)


    Java Code:
    public class Start
    
    {
        public Start()
        {
        }
        
        public static void main(String[] agrs)
        {
              Editor e = new Editor();
        }
    
    }
    Last edited by Coold0wn; 08-11-2011 at 05:35 PM.

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,321
    Rep Power
    25

    Default

    Check if there are errors:
    Open a command prompt, change to the folder with your jar file and enter: java -jar <YOURJARFILENAME>.jar
    To copy the contents of the command prompt window:
    Click on Icon in upper left corner
    Select Edit
    Select 'Select All' - The selection will show
    Click in upper left again
    Select Edit and click 'Copy'

    Paste here.

  3. #3
    Coold0wn is offline Member
    Join Date
    Aug 2011
    Posts
    71
    Rep Power
    0

    Default

    Microsoft Windows [Version 6.1.7600]
    Copyright (c) 2009 Microsoft Corporation. Alle Rechte vorbehalten.

    C:\Users\Julian>cd desktop

    C:\Users\**\Desktop>cd JumpNRunner

    C:\Users\**\Desktop\JumpNRunner>cd JumpNrunReadytoplay

    C:\Users\**\Desktop\JumpNRunner\JumpNrunReadytopla y>java -jar JumpNrun.jar
    Der Befehl "java" ist entweder falsch geschrieben oder
    konnte nicht gefunden werden.

    (= the command "java" is either written wrong or could not be found.)

    C:\Users\**\Desktop\JumpNRunner\JumpNrunReadytopla y>


    ...

    edit:
    i can open the .jar files of my older versions of the program.
    but with the new ones... it doesnt work anymore.
    and i can also create new .jar files with my older versions, which are able to run.

    i tried to open a old projekt and change everything so it would be like my new one... but then it didnt work anymore...

  4. #4
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,321
    Rep Power
    25

    Default

    Your java installation hasn't put the java command where it can be found by the OS.
    For testing you can use the full path. Find the location of the java.exe file and use that vs just java. For example:
    C:\Java\jdk_???_?\bin\java.exe -jar JumpNrun.jar

  5. #5
    Coold0wn is offline Member
    Join Date
    Aug 2011
    Posts
    71
    Rep Power
    0

    Default

    i found my Java at c:\Program Files(x86)\Java .. but i cant run the java.exe in the bin folder, because there is " " (space) after Program
    ... and if i just run the java.exe it wont do anything

    edit: i dont even know if there is an error... to me it seems like the .jar file just wouldnt do anything...
    and there is no error if i run the program via BlueJ..
    and the images i have, are in the folder with the .jar too


    ok it worked.. a friend of mine helped me:
    Java Code:
    Microsoft Windows [Version 6.1.7600]
    Copyright (c) 2009 Microsoft Corporation. Alle Rechte vorbehalten.
    
    C:\Users\***>cd C:\Program Files (x86)\Java\jre6\bin
    
    C:\Program Files (x86)\Java\jre6\bin>java.exe -jar C:\Users\Julian\Desktop\JumpN
    Runner\JumpNrunReadytoplay\JumpNrun.jar
    Exception in thread "main" java.lang.IllegalArgumentException: Width (-1) and he
    ight (-1) cannot be <= 0
            at java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknow
    n Source)
            at java.awt.image.BufferedImage.<init>(Unknown Source)
            at PickATile.toBufferedImage(PickATile.java:108)
            at PickATile.ImageToBufferedImage(PickATile.java:101)
            at PickATile.<init>(PickATile.java:33)
            at PickATileset.<init>(PickATileset.java:72)
            at Editor.<init>(Editor.java:32)
            at Start.main(Start.java:11)
    
    C:\Program Files (x86)\Java\jre6\bin>
    Last edited by Coold0wn; 08-11-2011 at 07:05 PM.

  6. #6
    Coold0wn is offline Member
    Join Date
    Aug 2011
    Posts
    71
    Rep Power
    0

    Default

    aaaaah nice!! thanks! now i know where the mistake comes from!!: )
    i have to remember how to do that... :)
    thanks a lot, youre hero =)

  7. #7
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,321
    Rep Power
    25

    Default

    Width (-1) and height (-1) cannot be <= 0
    ...
    at PickATile.toBufferedImage(PickATile.java:108)

    So you've solved the problem?

  8. #8
    Coold0wn is offline Member
    Join Date
    Aug 2011
    Posts
    71
    Rep Power
    0

Similar Threads

  1. Replies: 2
    Last Post: 05-26-2011, 05:38 AM
  2. Export jar file eclipse doesnt work no more?
    By Addez in forum New To Java
    Replies: 7
    Last Post: 03-14-2011, 10:45 AM
  3. Applet doesnt start or it doesnt show
    By 3dprogger in forum Java Applets
    Replies: 2
    Last Post: 01-07-2011, 07:03 PM
  4. Replies: 7
    Last Post: 09-28-2010, 12:17 AM
  5. Replies: 10
    Last Post: 11-01-2009, 09:42 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
  •