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 5 of 5

Thread: java web start not working

  1. #1
    Member
    Join Date
    Oct 2010
    Posts
    31
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default java web start not working

    I'm sorry if this is in the wrong forum but I couldn't find a place for questions on java web start. Anyway...

    I have a java application uploaded as a JWS program: Maze Mania

    Under the MazeMania folder, I have:

    MazeMania.html
    MazeMania.jar
    MazeMania.jnlp

    I also have a "classes" folder in here with all my un-jarred class files in the appropriate packages (folders), but I don't think they're being used.

    My html file looks like this:

    <html>
     
    <head>
    <title>Maze Mania</title>
    </head>
     
    <body>
    <script src="http://www.java.com/js/deployJava.js"></script>
        <script>
            // using JavaScript to get location of JNLP file relative to HTML page
            var dir = location.href.substring(0, location.href.lastIndexOf('/')+1);
            var url = dir + "MazeMania.jnlp";
            deployJava.createWebStartLaunchButton(url, '1.6.0');
        </script>
    </body>
     
    </html>

    My jnlp file looks like this:

    <?xml version="1.0" encoding="UTF-8"?>
    <jnlp spec="1.0+" 
        codebase="http://www.shahspace.com/JWS/MazeMania" 
        href="MazeMania.jnlp">
        <information>
            <title>Maze Mania</title>
            <vendor>Gibran shah</vendor>
        </information>
        <resources>
            <!-- Application Resources -->
            <j2se version="1.6+"
                  href="http://java.sun.com/products/autodl/j2se"/>
            <jar href="MazeMania.jar" main="true" />
     
        </resources>
        <application-desc
             name="Maze Mania"
             main-class="classes.Main">
         </application-desc>
         <update check="background"/>
    </jnlp>

    The jar file was created with the following command:

    jar cvf MazeMania.jar classes

    This was just above the classes folder. In the folder was the class file Main.class along with all subfolders containing class files belonging to whatever package was named after that folder. The jar file was then uploaded to my server.

    The problem is that when I try to launch this from the website, it says that it cannot find the Main class. Can anyone see why?

    P.S. - I tried changing main-class="classes.Main" to main-class="Main" but I get the same error.
    Last edited by gib65; July 12th, 2011 at 03:52 PM.


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: java web start not working

    Why do you have a classes folder instead of just putting them in the Jar?
    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
    Member
    Join Date
    Oct 2010
    Posts
    31
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default Re: java web start not working

    Quote Originally Posted by KevinWorkman View Post
    Why do you have a classes folder instead of just putting them in the Jar?
    That's what this tutorial says to do:

    2. Create a JAR file containing your application's class files and resources.
    For example, the following command creates a JAR file with the class files in the build/classes/webstartComponentArch directory.

    cd build/classes
    jar cvf DynamicTreeDemo.jar webstartComponentArch


    Instead of a "classes" folder, they have a "webstartComponentArch" folder.

    I tried going into my classes folder and typing this instead:

    jar cvf MazeMania.jar .

    then uploaded, but I still get the same error.

  4. #4
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: java web start not working

    Sorry, but one of us is misunderstanding the tutorial (it very well could be me). It looks to me like the tutorial is saying to jar the files in that folder into the jar as well. At the very least, I think you want your main class inside the jar. I could be wrong, but that's my approach.
    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!

  5. #5
    Member
    Join Date
    Oct 2010
    Posts
    31
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default Re: java web start not working

    I would think that would be done whether I jarred it above the folder or from within it. In any case, I tried both approaches and I get the same error either way.

    I think I'm going to cross-post this on http://www.java-forums.org/java-appl...tml#post221954.
    Last edited by gib65; July 13th, 2011 at 12:22 PM.

Similar Threads

  1. Java Web Start app exiting with access denie (java.lang.RuntimePermission
    By sonaljain in forum What's Wrong With My Code?
    Replies: 2
    Last Post: June 13th, 2011, 08:43 PM
  2. Regarding java Web Start Technology
    By sujas in forum Java Theory & Questions
    Replies: 1
    Last Post: May 4th, 2011, 07:44 AM
  3. Start With JAVA
    By infoprovider in forum The Cafe
    Replies: 2
    Last Post: July 28th, 2010, 04:34 AM
  4. How should i write and compile java with Ubuntu?
    By Talk Binary in forum Java IDEs
    Replies: 19
    Last Post: May 7th, 2009, 05:29 AM
  5. Replies: 4
    Last Post: January 27th, 2009, 12:03 AM