Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: JNLP and Applets

  1. #1
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,600
    Thanks
    24
    Thanked 313 Times in 293 Posts

    Default JNLP and Applets

    So I'm attempting to get an applet to run on a web host using the new(ish) Java Network Launch Protocol thingy, and I have been less than successful.

    NOTE: The below information has been modified in the following ways for security reasons:
    1. "[host]" indicates the index url for my website
    2. "[main]" indicates the main class (using . instead of /)

    I am currently getting an exception that reads: "JAR manifest codebase mismatch for http://[host]/testApp/runner.jar"

    So, here is where I currently stand with my code:
    HTML Page:
    <script src="http://www.java.com/js/deployJava.js"></script>
    <script> 
    	var attributes = {
    		code:'[main]',  width:1200, height:675} ; 
    	var parameters = {jnlp_href: 'JNLP_Page.jnlp'} ; 
    	deployJava.runApplet(attributes, parameters, '1.6'); 
    </script>

    JNLP Page:
    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp spec="1.0+" codebase="http://[host]" href="JNLP_Page.jnlp">
        <information>
            <title></title>
            <vendor></vendor>
        </information>
        <resources>
            <!-- Application Resources -->
            <j2se version="1.6+"
                href="http://java.sun.com/products/autodl/j2se" />
            <jar href="runner.jar" main="true" />
     
        </resources>
        <applet-desc 
             name=""
             main-class="[main]"
             width="1200"
             height="675">
         </applet-desc>
         <update check="background"/>
    </jnlp>

    Jar Manifest:
    Manifest-Version: 1.0
    Created-By: 1.6.0_14 (Sun Microsystems Inc.)
    Main-Class: [main]
    Codebase: [host]

    Does anyone have any ideas? I'm completely new to JNLP and the new security measures put in place in the recent java update.

    --- Update ---

    The main-class field in the manifest is using / instead of . btw (I can't seem to load the edit post button to change it)
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,166
    My Mood
    Hungover
    Thanks
    141
    Thanked 597 Times in 512 Posts

    Default Re: JNLP and Applets

    I'm not totally sure what's going on here, but I got a bunch of promising results for googling "jnlp JAR manifest codebase mismatch for" including this one: https://forums.oracle.com/thread/2552412

    Btw, posting text here doesn't really post any security concern. All the information you're hiding (the main class and codebase) are available to anybody who can find the jar or the jnlp file.

    As always, if you're having trouble, I suggest putting together an SSCCE that demonstrates exactly what you're doing. It's a bit hard to give you specific help without specific code.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,600
    Thanks
    24
    Thanked 313 Times in 293 Posts

    Default Re: JNLP and Applets

    I've looked at that link. The guy says he figured out what was wrong, but doesn't actually say what he did to fix it...

    I'll put the main class and codebase back as soon as I can edit the post again (I think my internet connection is just too horrible right now for that operation to succeed).

    I'm not sure how I could create an SSCCE for this issue. I've narrowed down the issue as much as I can think of. As far as I know, those three files are the only ones which matter, and I don't think any of that code can be simplified in any way. I don't think any of the java code in the jar file is relevant, it seems to just be some sort of miscommunication between the jar's manifest and the jnlp, but I'm not sure why there is a miscommunication.
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

  4. #4
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,166
    My Mood
    Hungover
    Thanks
    141
    Thanked 597 Times in 512 Posts

    Default Re: JNLP and Applets

    The edit button is broken, it's not just you. So is the reply with quote button.

    If the first page didn't contain an answer, try the other pages in the google search. It might take some digging.

    Without seeing the specifics (preferably as an SSCCE) it's pretty impossible to tell you exactly what's going on other than to point you to that google search.

    There are a bunch of jnlp examples on StaticVoidGames since that's what I use to deploy all of the games. Maybe looking at a few of those and comparing them to what you have would help.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. javax.jnlp.UnavailableServiceException: uninitialized (PROBLEM AT RUNTIME)
    By knowNothing23 in forum What's Wrong With My Code?
    Replies: 5
    Last Post: November 15th, 2012, 03:05 PM
  2. noClassDefFoundError trying to run JNLP file with Web Start
    By sonicjr in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 13th, 2012, 12:43 AM
  3. Java and JNLP
    By parvendra in forum Java Theory & Questions
    Replies: 9
    Last Post: March 4th, 2011, 09:04 AM
  4. JNLP webstart application in localhost
    By Jhovarie in forum Threads
    Replies: 2
    Last Post: February 14th, 2011, 05:53 PM
  5. can't start jnlp file
    By NARs in forum Java Applets
    Replies: 1
    Last Post: December 1st, 2009, 02:25 AM