Page 1 of 2 12 LastLast
Results 1 to 20 of 31
  1. #1
    plasticfood is offline Member
    Join Date
    Sep 2010
    Posts
    32
    Rep Power
    0

    Default how to use java launcher?

    i'm trying to make a exe file for a friend who doesn't have java compiler installed on their computer. i'm using java launcher, and it asks for the class file, and then it asks for the output file which i don't know what it is.

  2. #2
    Hibernate's Avatar
    Hibernate is offline Senior Member
    Join Date
    Dec 2010
    Location
    Stockholm, Sweden
    Posts
    222
    Blog Entries
    9
    Rep Power
    4

    Default

    You do not need a Java compiler to run Java, you just need the JDK, which everyone should have instead because it is needed for Applets on the Web.
    If he or she does not have a JDK just tell him ever to install it, shouldn't be a problem.

    Then just make a .jar and tell him to run it using:
    java -jar JARFILE
    (I don't know if it is added to the Windows Register yet at the installation of Java)



    I've not used “java launcher”, but my guess is:

    Your class file should be your class file you run to start the program (or .jar file?).
    And your output file is PROGRAM_ALIAS.exe

  3. #3
    latinoNJ is offline Member
    Join Date
    Dec 2010
    Posts
    5
    Rep Power
    0

    Default

    Your friend doesn't need JDK. He should have the JRE (Java Runtime Env.) which is this one Download Free Java Software

    Maybe you could use any of these JSmooth - Java Executable Wrapper http://winrun4j.sourceforge.net/
    Last edited by latinoNJ; 12-29-2010 at 02:26 AM.

  4. #4
    Hibernate's Avatar
    Hibernate is offline Senior Member
    Join Date
    Dec 2010
    Location
    Stockholm, Sweden
    Posts
    222
    Blog Entries
    9
    Rep Power
    4

    Default

    Oh, right...
    Sorry!

  5. #5
    plasticfood is offline Member
    Join Date
    Sep 2010
    Posts
    32
    Rep Power
    0

    Default

    ok i created the jar file, but it's in a zip file so i fix the files association. when i tried to run it, it says "could not find the main class......"

    so now i've tried jsmooth, and when i tried to run the program, it gives me the same error message. the program is tested and is a simple gui program that prints a simple sentence. what's going on?
    Last edited by plasticfood; 12-29-2010 at 04:17 AM.

  6. #6
    Hibernate's Avatar
    Hibernate is offline Senior Member
    Join Date
    Dec 2010
    Location
    Stockholm, Sweden
    Posts
    222
    Blog Entries
    9
    Rep Power
    4

    Default

    Quote Originally Posted by plasticfood View Post
    ok i created the jar file, but it's in a zip file so i fix the files association. when i tried to run it, it says "could not find the main class......"
    I'm not sure, but I think that is what we are tring to fix at
    Doesn't anyone here know how to help? I feel like I wanna hang myself
    I have posted what if think is a working solution in your case.
    Ex animo! Hibernate
    Java, Arch Linux, C, GPL v3, Bash, Eclipse, Linux VT, GNOME 2 and many buttons on windows.

  7. #7
    Hibernate's Avatar
    Hibernate is offline Senior Member
    Join Date
    Dec 2010
    Location
    Stockholm, Sweden
    Posts
    222
    Blog Entries
    9
    Rep Power
    4

    Default

    Here the post I think will fix it:


    Can you extract (unzip) the jar file (using 7-zip, WinZip or whatever)
    and try to run your main class.

    Does there exist a manifest file, by standard named
    META-INF/MANIFEST.MF

    If does there exist a line beginning with "Main-Class: " and does it say
    Main-Class: FULLY_QUALIFIED_MAIN_CLASS_NAME

    Create a manifest file META-INF/MANIFEST.MF
    Fill it this data:
    Java Code:
    Manifest-Version: FILL_IN
    Package-Version: FILL_IN
    Product-Name: FILL_IN
    Package-Vendor: FILL_IN
    Created-By: FILL_IN
    Main-Class: FILL_IN
    Class-Path: WHITESPACE_SEPARATED_JAR_FILES
    And rebuild your jar file:
    cd PATH_WITH_FILES
    jar cfm META-INF/MANIFEST.MF **
    Ex animo! Hibernate
    Java, Arch Linux, C, GPL v3, Bash, Eclipse, Linux VT, GNOME 2 and many buttons on windows.

  8. #8
    plasticfood is offline Member
    Join Date
    Sep 2010
    Posts
    32
    Rep Power
    0

    Default

    on jsmooth, it says java is not found on my computer.

  9. #9
    Hibernate's Avatar
    Hibernate is offline Senior Member
    Join Date
    Dec 2010
    Location
    Stockholm, Sweden
    Posts
    222
    Blog Entries
    9
    Rep Power
    4

    Default

    If you open the command prompt and type
    java -version
    and it does not print your version of Java, this
    should do the trick, otherwise I do not think I can help you.


    http://post.dyndns.org/image2-00.png
    http://post.dyndns.org/image2-01.png
    http://post.dyndns.org/image2-02.png
    http://post.dyndns.org/image2-03.png
    http://post.dyndns.org/image2-04.png

    Now you append (add) the the folder you installed Java to:

    http://post.dyndns.org/image2-05.png

    I think the path should end with \bin

    Then you click 'OK' on all opened windows.
    Ex animo! Hibernate
    Java, Arch Linux, C, GPL v3, Bash, Eclipse, Linux VT, GNOME 2 and many buttons on windows.

  10. #10
    plasticfood is offline Member
    Join Date
    Sep 2010
    Posts
    32
    Rep Power
    0

    Default

    yes there is a META-INF folder and a MANIFEST.MF file inside of it.

    and there isn't a Main-Class: FULLY_QUALIFIED_MAIN_CLASS_NAME

    when i extract it, it only has the "program.class" and the META-INF folder.

    it does print out the java version..."1.6.0_20"
    Last edited by plasticfood; 12-29-2010 at 04:42 AM.

  11. #11
    Hibernate's Avatar
    Hibernate is offline Senior Member
    Join Date
    Dec 2010
    Location
    Stockholm, Sweden
    Posts
    222
    Blog Entries
    9
    Rep Power
    4

    Default

    If there is no Main-Class entry Java will not know what class to run.
    Ex animo! Hibernate
    Java, Arch Linux, C, GPL v3, Bash, Eclipse, Linux VT, GNOME 2 and many buttons on windows.

  12. #12
    plasticfood is offline Member
    Join Date
    Sep 2010
    Posts
    32
    Rep Power
    0

    Default

    it has the "program.class" file in it which is the main class, is that it?

  13. #13
    Hibernate's Avatar
    Hibernate is offline Senior Member
    Join Date
    Dec 2010
    Location
    Stockholm, Sweden
    Posts
    222
    Blog Entries
    9
    Rep Power
    4

    Default

    Quote Originally Posted by plasticfood View Post
    it does print out the java version..."1.6.0_20"
    You are running on 3 revisions old version of Java.
    Ex animo! Hibernate
    Java, Arch Linux, C, GPL v3, Bash, Eclipse, Linux VT, GNOME 2 and many buttons on windows.

  14. #14
    plasticfood is offline Member
    Join Date
    Sep 2010
    Posts
    32
    Rep Power
    0

    Default

    what the?? my pc is pretty new. that's weird, i'll download the latest version...

  15. #15
    Hibernate's Avatar
    Hibernate is offline Senior Member
    Join Date
    Dec 2010
    Location
    Stockholm, Sweden
    Posts
    222
    Blog Entries
    9
    Rep Power
    4

    Default

    Quote Originally Posted by plasticfood View Post
    it has the "program.class" file in it which is the main class, is that it?
    Yes.

    Add
    Main-Class: program
    to your manifest.


    Also you should not use lower case on the first letter on class names.
    Rename the class to Program and source file to Program.java and recompile.
    If your class is named Program Add
    Main-Class: Program
    to your manifest.

    Since you are running Windows, casing on files will have no effect, but I would recommend to fix the casing.
    Last edited by Hibernate; 12-29-2010 at 04:52 AM.
    Ex animo! Hibernate
    Java, Arch Linux, C, GPL v3, Bash, Eclipse, Linux VT, GNOME 2 and many buttons on windows.

  16. #16
    Hibernate's Avatar
    Hibernate is offline Senior Member
    Join Date
    Dec 2010
    Location
    Stockholm, Sweden
    Posts
    222
    Blog Entries
    9
    Rep Power
    4

    Default

    Quote Originally Posted by plasticfood View Post
    what the?? my pc is pretty new. that's weird, i'll download the latest version...
    There revisions is nothing, not even a minor release.
    I updated my Java (in Windows, I normally run GNU/Linux) from _22 to _23
    yesterday night (UTC).
    Ex animo! Hibernate
    Java, Arch Linux, C, GPL v3, Bash, Eclipse, Linux VT, GNOME 2 and many buttons on windows.

  17. #17
    plasticfood is offline Member
    Join Date
    Sep 2010
    Posts
    32
    Rep Power
    0

    Default

    ok i installed the latest version, and jsmooth is still telling me that java is not found on my computer...

  18. #18
    plasticfood is offline Member
    Join Date
    Sep 2010
    Posts
    32
    Rep Power
    0

    Default

    stupid question but what's a manifest?

  19. #19
    Hibernate's Avatar
    Hibernate is offline Senior Member
    Join Date
    Dec 2010
    Location
    Stockholm, Sweden
    Posts
    222
    Blog Entries
    9
    Rep Power
    4

    Default

    And you updated your manifest with a Main-Class entity?


    I'll need to shutdown my computer now and try to resurrect my graphics card,
    and maybe go into hibernation (not my computer), if so; hope you'll get it working, otherwise I'll be online tomorrow.
    Ex animo! Hibernate
    Java, Arch Linux, C, GPL v3, Bash, Eclipse, Linux VT, GNOME 2 and many buttons on windows.

  20. #20
    Hibernate's Avatar
    Hibernate is offline Senior Member
    Join Date
    Dec 2010
    Location
    Stockholm, Sweden
    Posts
    222
    Blog Entries
    9
    Rep Power
    4

    Default

    Quote Originally Posted by plasticfood View Post
    stupid question but what's a manifest?
    It's your MANIFEST.MF file inside the META-INF folder.
    It content should be similar to
    [/code]
    Manifest-Version: FILL_IN
    Package-Version: FILL_IN
    Product-Name: FILL_IN
    Package-Vendor: FILL_IN
    Created-By: FILL_IN
    Main-Class: FILL_IN
    Class-Path: WHITESPACE_SEPARATED_JAR_FILES
    [code]

    See my earlier post if you need to create one.
    Ex animo! Hibernate
    Java, Arch Linux, C, GPL v3, Bash, Eclipse, Linux VT, GNOME 2 and many buttons on windows.

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 0
    Last Post: 12-21-2010, 04:21 PM
  2. Java Launcher and Applets
    By Bomber_Will in forum Java Applets
    Replies: 2
    Last Post: 01-15-2010, 01:41 AM
  3. JVM launcher?
    By manoj.maniraj in forum Advanced Java
    Replies: 1
    Last Post: 04-07-2009, 12:30 AM
  4. writing a program launcher (or Timer)
    By Farzaneh in forum Threads and Synchronization
    Replies: 3
    Last Post: 02-17-2009, 10:00 AM

Posting Permissions

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