Page 3 of 3 FirstFirst 123
Results 41 to 59 of 59
  1. #41
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,457
    Rep Power
    25

    Default

    OK, I been trying to solve a different problem. Now you say there is a server involved. Now server configuration is involved besides a possible problem with the html and jar file.

    To isolate the problem, Have you tried copying the html file and the jar file to a local folder and opening the html file with the browser? That is don't use a server, only the browser reading and html file.

  2. #42
    Hodson is offline Member
    Join Date
    May 2010
    Posts
    26
    Rep Power
    0

    Default

    All the server is doing is making the JSP page viewable in my browser.

    I have used a html file too though (in the same folder - no server) and I get the exact same problem. That is, it says its started but its just blank.

    I'm off to the gym for a bit now so won't reply for a bit.

  3. #43
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,457
    Rep Power
    25

    Default

    I found the missing jar file with the swing components, compiled your program with it, added the jar file reference to the html file, opened the html file in a browser and it displayed the three text fields and the button. I enter some numbers, press the button and I get a message about weight. It appears to work.

    So what is different about your setup? It's on an iMac?

    Using a server can require setup. Reading an html file from a local folder doesn't.

  4. #44
    Hodson is offline Member
    Join Date
    May 2010
    Posts
    26
    Rep Power
    0

    Default

    Well i'm glad it works for someone.

    Nothing should be different really and I can't see why an iMac (or OSX) would cause this problem as the operating system doesn't have to do anything.

    I will try running it on Windows when I get chance but obviously, it would be nice to get it working on OSX as that's what I use all the time.

  5. #45
    Webuser is offline Senior Member
    Join Date
    Dec 2008
    Posts
    526
    Rep Power
    0

    Lightbulb

    Quote Originally Posted by Hodson View Post
    Well i'm glad it works for someone.

    Nothing should be different really and I can't see why an iMac (or OSX) would cause this problem as the operating system doesn't have to do anything.

    I will try running it on Windows when I get chance but obviously, it would be nice to get it working on OSX as that's what I use all the time.
    I just wanted to ask... Emm is you JRE is for iMAC ?

    If there is OS JRE problem I think you should update your Mac JRE with this link
    Mac OS X: Updating your software
    If my answer helped you. Please click my "REP" button and add a comment
    Have a Good Java Coding :)

  6. #46
    Hodson is offline Member
    Join Date
    May 2010
    Posts
    26
    Rep Power
    0

    Default

    Quote Originally Posted by Webuser View Post
    I just wanted to ask... Emm is you JRE is for iMAC ?

    If there is OS JRE problem I think you should update your Mac JRE with this link
    Mac OS X: Updating your software

    That was one of the first thing's I did. Everything is up to date.

  7. #47
    Webuser is offline Senior Member
    Join Date
    Dec 2008
    Posts
    526
    Rep Power
    0

    Question

    Quote Originally Posted by Hodson View Post
    That was one of the first thing's I did. Everything is up to date.
    Did you add the required netbeans Layout manager classes to your applet jar as I recommended before ?
    Provide us your applet jar inner classes structure screenshot please.
    If my answer helped you. Please click my "REP" button and add a comment
    Have a Good Java Coding :)

  8. #48
    Webuser is offline Senior Member
    Join Date
    Dec 2008
    Posts
    526
    Rep Power
    0

    Exclamation

    Quote Originally Posted by Hodson View Post
    Sorry, I got distracted by another project I am working on.

    I added the swing layout extensions library (which contains the org.jdesktop.layout package) and then modified the archive tag to the following:

    Java Code:
    archive="BMI.jar,swing-layout-1.0.4.jar"
    Now when I run the JSP page, it says that the applet has started but it doesn't show on the page at all.
    No you should add swing-layout-1.0.4.jar inner classes right into your BMI.jar
    Just extract its folders and classes and add to BMI.jar!
    I keep saying that from the beginning...
    If my answer helped you. Please click my "REP" button and add a comment
    Have a Good Java Coding :)

  9. #49
    Hodson is offline Member
    Join Date
    May 2010
    Posts
    26
    Rep Power
    0

    Default

    I don't see why you have to put it inside the BMI.jar? As long as you call the correct path, it shouldn't matter where it is.

    Also, it seems to have worked for Norm doing it the way I have.


    I have however just added the classes from within the swing layout jar directly into the BMI.jar and it goes back to displaying the error message on the page. When I do it my way, the applet starts but I don't see it (however, Norm does on his computer).

  10. #50
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,457
    Rep Power
    25

    Default

    You don't have to merge the classes into the same jar file. You can append the swing jar file in the <applet archive= tag as shown above.

    Have you ever tried the code without a server?

    When I do it my way,
    How is that?

  11. #51
    Hodson is offline Member
    Join Date
    May 2010
    Posts
    26
    Rep Power
    0

    Default

    That's what I have done

    Java Code:
    <applet code="bmi.BMIApplet" archive="BMI.jar,swing-layout-1.0.4.jar" height="300" width="300"/>
    Yeah, I have tried it without the server, just get the same problem.

    By "my way" I meant by using the applet code above and not having the two jar files compiled into one.

  12. #52
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,457
    Rep Power
    25

    Default

    Sorry, no ideas on how to solve this.

    Go back to basics: Write the simple "Hello World" applet and see if that works. If not, then you have a system/installation problem. If it does work, then try working with your program. I removed all the layout stuff generated by your IDE and added a simple label to your applet and got a simple gray box with the label showing. Then move on from there to see why the generated layout doesn't work.

  13. #53
    Hodson is offline Member
    Join Date
    May 2010
    Posts
    26
    Rep Power
    0

    Default

    Quote Originally Posted by Norm View Post
    Sorry, no ideas on how to solve this.

    Go back to basics: Write the simple "Hello World" applet and see if that works. If not, then you have a system/installation problem. If it does work, then try working with your program. I removed all the layout stuff generated by your IDE and added a simple label to your applet and got a simple gray box with the label showing. Then move on from there to see why the generated layout doesn't work.

    I've kind of put this "project" to the side at the moment as i'm trying to get my own web server up and running correctly so I can host some java projects. I know I have had an applet working on here not so long ago but will give a simple applet another go again at some point.

    I will give you both some rep (if that's possible) as you have both been helpful.

  14. #54
    Webuser is offline Senior Member
    Join Date
    Dec 2008
    Posts
    526
    Rep Power
    0

    Lightbulb

    Quote Originally Posted by Hodson View Post
    I don't see why you have to put it inside the BMI.jar? As long as you call the correct path, it shouldn't matter where it is.

    Also, it seems to have worked for Norm doing it the way I have.


    I have however just added the classes from within the swing layout jar directly into the BMI.jar and it goes back to displaying the error message on the page. When I do it my way, the applet starts but I don't see it (however, Norm does on his computer).
    applets and sys PATH are big difference :)
    you should not just add classes but the the jar lib packages' structure accouring to your applet import refs...
    applets are not like servlets so they don't use sys PATH things ;)
    If my answer helped you. Please click my "REP" button and add a comment
    Have a Good Java Coding :)

  15. #55
    Webuser is offline Senior Member
    Join Date
    Dec 2008
    Posts
    526
    Rep Power
    0

    Lightbulb

    Quote Originally Posted by Hodson View Post
    I don't see why you have to put it inside the BMI.jar? As long as you call the correct path, it shouldn't matter where it is.

    Also, it seems to have worked for Norm doing it the way I have.


    I have however just added the classes from within the swing layout jar directly into the BMI.jar and it goes back to displaying the error message on the page. When I do it my way, the applet starts but I don't see it (however, Norm does on his computer).
    I do hope you'll see that now :)

    I think that shouldn't be a personal JRE or OS problem so...
    I have added the netbeans layout manager right into the applet jar just to refresh my fingers... anyway, I want you to run the html file and see if the applet runs!

    I was testing it with Opera. So I recommend you to run it with Opera, too, because Opera runs Applets not with some plugins but with JRE
    Attached Files Attached Files
    Last edited by Webuser; 05-27-2010 at 02:32 AM.
    If my answer helped you. Please click my "REP" button and add a comment
    Have a Good Java Coding :)

  16. #56
    Hodson is offline Member
    Join Date
    May 2010
    Posts
    26
    Rep Power
    0

    Default

    Cheers WebUser, that runs fine in my browser now. I tried to add some rep for you but as I already did so yesterday, it won't allow me too.

    I still don't fully understand why the layout stuff has to be put directly into the jar and can't be called but as long as I know that for the future, I should be fine!

    I believe this thread can be marked as solved now.

  17. #57
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,457
    Rep Power
    25

    Default

    the layout stuff has to be put directly into the jar
    That's not true on Windows. I was able to have two jar files referenced in the archive= parameter of the <APPLET tag and it worked.

    Have you tried REMOVING all the org.jdesktop. GUI components from the applet and add only a simple JLabel to the GUI so that all the classes you need are in the JRE and your jar file?
    Something like this:
    add(new javax.swing.JLabel("This is a test"));

  18. #58
    Hodson is offline Member
    Join Date
    May 2010
    Posts
    26
    Rep Power
    0

    Default

    I just uploaded my original applet (with reference to the two separate jar files) to my unix webserver and it runs fine on there like that.

    It must be something to do with my iMac OS that causes it to only work when you have the one jar file containing all the files.


    And no Norm, I haven't tried that. Been busy trying to get my web server working properly and I'm still having trouble with it now.

  19. #59
    Webuser is offline Senior Member
    Join Date
    Dec 2008
    Posts
    526
    Rep Power
    0

    Lightbulb

    Quote Originally Posted by Hodson View Post
    Cheers WebUser, that runs fine in my browser now. I tried to add some rep for you but as I already did so yesterday, it won't allow me too.

    I still don't fully understand why the layout stuff has to be put directly into the jar and can't be called but as long as I know that for the future, I should be fine!

    I believe this thread can be marked as solved now.
    You have to understand that you must add all required NetBeans layout classes not because "it is always must be so" but because of NetBeans specific absolute layout manager I mentioned before. It is NetBeans stuff only :) default JRE doesn't contain this layout manager so you have to make sure to have one right in your applet jar ;) It's easy.
    Just imagine like a... you want to use apachePOI or something outer of JRE... So in that case you have to add all required classes right into your jar too ;)
    If my answer helped you. Please click my "REP" button and add a comment
    Have a Good Java Coding :)

Page 3 of 3 FirstFirst 123

Similar Threads

  1. Replies: 2
    Last Post: 09-29-2009, 03:33 PM
  2. Applet with RS-232
    By j_jpg in forum Java Applets
    Replies: 0
    Last Post: 07-07-2009, 10:59 AM
  3. Calling another applet on click of button in one applet
    By niteshwar.bhardwaj in forum Java 2D
    Replies: 1
    Last Post: 02-19-2009, 12:54 PM
  4. Need with an applet
    By maggie_2 in forum Java Applets
    Replies: 6
    Last Post: 09-21-2008, 08:07 PM
  5. Replies: 4
    Last Post: 06-08-2007, 06:15 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
  •