Results 1 to 10 of 10
  1. #1
    matvey is offline Member
    Join Date
    Sep 2009
    Posts
    9
    Rep Power
    0

    Default how to find class name when have only jar file?

    I have only a jar file call "myjar.jar" can run on desktop , when i want embed it to html file , i use

    Java Code:
    <APPLET CODE="???.class" archive="myjar.jar"  WIDTH=200 HEIGHT=500>
    </APPLET>
    The problem is i can not know the name of class because i have only a jar file. How i can find the class name? Thanks

  2. #2
    KM88 is offline Member
    Join Date
    Oct 2009
    Location
    Canada
    Posts
    14
    Rep Power
    0

    Default

    I'm still new to all this, so not sure if this will work. But I know you can view the files within a .jar file by typing jar tf ***.jar (*** name of jar file) in the command prompt. should show you all files, including the .class file. I think, lol

  3. #3
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    Where did you get the jar file from? Why don't you ask the person who created the jar file?

  4. #4
    matvey is offline Member
    Join Date
    Sep 2009
    Posts
    9
    Rep Power
    0

    Default

    thanks. but i can not use the command "tf xxx.jar" in Dos , it say "tf is not recognized as an internal or external command..." . Can you advise me again?

    Indeed , runnable jar file is created by me . In my project , i have 3 classes class1.class , class2.class and class3.class . The function main is in class1.class . I place 3 classes and file jar ( i use eclipse to export and try run in desktop , success ) in the same folder. So I create an html file and type in body "<APPLET CODE="class1.class" archive="myjar.jar" WIDTH=200 HEIGHT=500>
    </APPLET>"

    it doesn't run... T_T

  5. #5
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    Are any of those classes applets? If you created the jar file then surely you know what classes are in it and which one you want to use for the applet, right?

  6. #6
    matvey is offline Member
    Join Date
    Sep 2009
    Posts
    9
    Rep Power
    0

    Default

    oh , i find that i forget to extends Applet in class ... But , i try append :

    public class Snake extends JFrame,Applet implements Runnable,KeyListener,ActionListener
    It show errors. Why ? And solve?

  7. #7
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    Quote Originally Posted by matvey View Post
    oh , i find that i forget to extends Applet in class ... But , i try append :



    It show errors. Why ? And solve?
    Of course it shows errors. You don't really have an Applet do you? You had a normal Java application all along.
    Read the Applets tutorial from Sun's tutorial to find out how to create applets.

  8. #8
    matvey is offline Member
    Join Date
    Sep 2009
    Posts
    9
    Rep Power
    0

    Default

    Oh thanks... but please tell me how to use both JFrame and Applet? Impossible?

  9. #9
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    Why? You can't use both at the same time. They solve different problems and one runs on a browser while the other does not.

  10. #10
    matvey is offline Member
    Join Date
    Sep 2009
    Posts
    9
    Rep Power
    0

Similar Threads

  1. Replies: 6
    Last Post: 05-18-2010, 05:11 PM
  2. Could not find main class
    By Andyj in forum New To Java
    Replies: 2
    Last Post: 10-06-2009, 12:47 AM
  3. Replies: 1
    Last Post: 07-03-2009, 08:41 PM
  4. Can't find class
    By bozovilla in forum New To Java
    Replies: 2
    Last Post: 07-31-2008, 05:45 AM
  5. Replies: 0
    Last Post: 05-13-2008, 06:16 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
  •