Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Me Again!  Getting error "Could not find main-class" when trying to run an application using WebStart

Posted on 2005-04-25
10
Medium Priority
?
499 Views
Last Modified: 2011-09-20
Hi,

I am trying (and failing) to install an java app using WebStart.  But I am getting the error message ...

Could not find main-class com.churchillchina.gapanalysis.GapDataClient in http://localhost/jars/gapdataclient.jar

I have posted below the build bat I use to construct the jar file, the JNLP file that launches WebStart and the full error message that I get in WebStart when it tries to run the app.  I copy the jar from my dev machine to the server.  Hopefully someone will know what I'm doing wrong!

Cheers,
Steve



BUILDGAPDATACLIENT.BAT ==================

javac com\churchillchina\gapanalysis\GapDataClient.java -d build\gapdataclient\lib
javac com\churchillchina\gapanalysis\GapDataClientEngine.java -d build\gapdataclient\lib
javac com\churchillchina\gapanalysis\GapDataClientFrame.java -d build\gapdataclient\lib
javac com\churchillchina\gapanalysis\GapDataType.java -d build\gapdataclient\lib
javac com\churchillchina\gapanalysis\GapDataValue.java -d build\gapdataclient\lib
javac com\churchillchina\gapanalysis\GapException.java -d build\gapdataclient\lib
javac com\churchillchina\gapanalysis\GapGlobals.java -d build\gapdataclient\lib
javac com\churchillchina\gapanalysis\GapMessage.java -d build\gapdataclient\lib
javac com\churchillchina\gapanalysis\PriceRanges.java -d build\gapdataclient\lib
javac com\churchillchina\gapanalysis\ProdInRet.java -d build\gapdataclient\lib
javac com\churchillchina\gapanalysis\Product.java -d build\gapdataclient\lib
javac com\churchillchina\gapanalysis\Retailer.java -d build\gapdataclient\lib
javac com\churchillchina\gapanalysis\SearchResults.java -d build\gapdataclient\lib

jar cvfm build\\gapdataclient\\gapdataclient.jar build\\gapdataclient\\jar_manifest.txt build\gapdataclient\lib\com\churchillchina\gapanalysis\*.class com\churchillchina\gapanalysis\GapCombo.properties com\churchillchina\gapanalysis\GapJdbc.properties com\churchillchina\gapanalysis\GapNetwork.properties com\churchillchina\gapanalysis\images\gap_logo_48_48.gif lib\jt400.jar

cd build
sign gapdataclient\gapdataclient.jar

END OF BUILDGAPDATACLIENT.BAT ==================



SIGN.BAT ==================

jarsigner %1 steve
jarsigner -verify -certs %1
C:\WINNT\System32\rundll32.exe cryptext.dll,CryptExtAddCER steve.crt

END OF SIGN.BAT ==================




GAPDATACLIENT.JNLP =========================

<?xml version="1.0" encoding="utf-8"?>
<!-- JNLP File for Gap Analysis Application -->
<!-- <jnlp spec="1.5+" codebase="http://localhost/webstart" href="jnlp/gapdataclient.jnlp"> -->
<jnlp spec="1.5+" codebase="http://localhost" href="jnlp/gapdataclient.jnlp">
      <information>    
            <title>Gap Analysis Application</title>
            <vendor>Churchill China (UK) Ltd</vendor>
            <homepage href="docs/help.html" />
            <description>Gap Analysis Application</description>
            <description kind="short">Client-Server application for recording and viewing product placement marketing data.</description>
          <icon href="assets/gap_logo_48_48.gif" />
          <icon kind="splash" href="assets/gap_logo_48_48.gif" />
          <offline-allowed />
          <association mime-type="application-x/gapanalysis-file" extensions="gapanalysis" />
          <shortcut online="false">
                <desktop />
                <menu submenu="Churchill China Applications" />
          </shortcut>  
   </information>  
   
   <information os="linux">      
            <title>Gap Analysis on Linux</title>
            <homepage href="docs/linuxhelp.html" />  
      </information>  
      <security>
            <all-permissions/>  
      </security>  
      <resources>    
            <j2se version="1.4.2+" java-vm-args="-esa -Xnoclassgc" />    
            <jar href="/jars/gapdataclient.jar"/>  
      </resources>  
      <application-desc main-class="com.churchillchina.gapanalysis.GapDataClient" />
</jnlp>

END OF GAPDATACLIENT.JNLP =========================


ERROR IN WEBSTART    =========================


An error occurred while launching/running the application.

Title: Gap Analysis Application
Vendor: Churchill China (UK) Ltd
Category: Launch File Error

Could not find main-class com.churchillchina.gapanalysis.GapDataClient in http://localhost/jars/gapdataclient.jar


JNLPException[category: Launch File Error : Exception: null : LaunchDesc:
<jnlp spec="1.5+" codebase="http://localhost/" href="http://localhost/jnlp/gapdataclient.jnlp">
  <information>
    <title>Gap Analysis Application</title>
    <vendor>Churchill China (UK) Ltd</vendor>
    <homepage href="http://localhost/docs/help.html"/>
    <description>Gap Analysis Application</description>
    <description kind="short">Client-Server application for recording and viewing product placement marketing data.</description>
    <icon href="http://localhost/assets/gap_logo_48_48.gif" kind="default"/>
    <icon href="http://localhost/assets/gap_logo_48_48.gif" kind="splash"/>
    <shortcut online="false">
      <menu submenu="Churchill China Applications"/>
    </shortcut>
    <association extensions="gapanalysis" mime-type="application-x/gapanalysis-file"/>
    <offline-allowed/>
  </information>
  <security>
    <all-permissions/>
  </security>
  <resources>
    <j2se java-vm-args="-esa -Xnoclassgc" version="1.4.2+"/>
    <jar href="http://localhost/jars/gapdataclient.jar" download="eager" main="false"/>
  </resources>
  <application-desc main-class="com.churchillchina.gapanalysis.GapDataClient"/>
</jnlp> ]
      at com.sun.javaws.LaunchDownload.getMainClassName(Unknown Source)
      at com.sun.javaws.Launcher.continueLaunch(Unknown Source)
      at com.sun.javaws.Launcher.handleApplicationDesc(Unknown Source)
      at com.sun.javaws.Launcher.handleLaunchFile(Unknown Source)
      at com.sun.javaws.Launcher.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
0
Comment
Question by:steve_bagnall
  • 5
  • 3
  • 2
10 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 13858444
Have you got

Main-Class: com.churchillchina.gapanalysis.GapDataClient

in your manifest?
0
 
LVL 5

Author Comment

by:steve_bagnall
ID: 13858541
Hi,

Yeah this is my manifest file:

Manifest-Version: 1.0
Main-Class: com.churchillchina.gapanalysis.GapDataClient


Cheers,
Steve
0
 
LVL 35

Expert Comment

by:TimYates
ID: 13858648
Open gapdataclient.jar in WinZip

is the class there?

In the correct folder?

Probably not :-/

I reckon there's an issue with your jar building bit of your script...

Tim
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 86

Expert Comment

by:CEHJ
ID: 13858679
>>jar cvfm build\\gapdataclient\\gapdataclient.jar build\\gapdataclient\\jar_manifest.txt

I think you should remove those double slashes and replace by single ones
0
 
LVL 5

Author Comment

by:steve_bagnall
ID: 13858699
Yeah GapDataClient.class is there (379k).  But the path is

build\gapdataclient\lib\com\churchillchina\gapanalysis\

should it be

com\churchillchina\gapanalysis\

if so how do I ensure this whilst keeping my build\lib structure intact, as I find this quite an organised way of doing it?

Cheers,
Steve
0
 
LVL 35

Accepted Solution

by:
TimYates earned 2000 total points
ID: 13858727
you need the

    -C build

option with the jar command
0
 
LVL 35

Expert Comment

by:TimYates
ID: 13858737
jar cvfm build\\gapdataclient\\gapdataclient.jar build\\gapdataclient\\jar_manifest.txt -C build gapdataclient\lib\com\churchillchina\gapanalysis\*.class com\churchillchina\gapanalysis\GapCombo.properties com\churchillchina\gapanalysis\GapJdbc.properties com\churchillchina\gapanalysis\GapNetwork.properties com\churchillchina\gapanalysis\images\gap_logo_48_48.gif lib\jt400.jar

(I think)
0
 
LVL 35

Expert Comment

by:TimYates
ID: 13858958
or...

cd build\gapdataclient\lib

before you call jar (which may be easier) -- I can't get the -C option to work right on my machine (but I am on linux...it may work ok on Windows)
0
 
LVL 5

Author Comment

by:steve_bagnall
ID: 13859002
Tim,

Although the GapDataClient.java file was being compiled into the lib directory, it wasn't being added to the jar with the *.class command, so I had to add it manually with its own line.  I now have it coming up with a NullPointerException (well this is Java!), but that'll be my App.  Thanks for all your help!

Cheers,
Steve
0
 
LVL 35

Expert Comment

by:TimYates
ID: 13859106
Good luck again ;-)

Hope you find the bug ok!

Tim
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses
Course of the Month21 days, 5 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question