[WebStart] "Could not find main-class"

  • Thread starter Tarlika Elisabeth Schmitz
  • Start date
T

Tarlika Elisabeth Schmitz

Hello,

I am encountering the following problem with my webstart application:

The application consists of a couple of dozen jar files. I specify the
main class via
<application-desc main-class="app.Main"/>
but it is only found if the jar file containing the main class is the
first listed in <resources>. If this jar file is not the first the above
error occurs.

This is a nuisance as I am generating the JNLP file with an Ant task
using fileset for the list of resources
(http://www.roxes.com/produkte/rat.html) and the main jar file
inevitably doesn't end up at the top.

Is this a feature? Is there a work-around?


Set-up: Sun's SDK 1.4.2_01 on Win2K

--


Regards/Gruß,

Tarlika Elisabeth Schmitz
 
A

Andrew Thompson

I am encountering the following problem with my webstart application:

The application consists of a couple of dozen jar files. I specify the
main class via
<application-desc main-class="app.Main"/>
but it is only found if the jar file containing the main class is the
first listed in <resources>. If this jar file is not the first the above
error occurs.

Untested.. have you tried..
<jar href="YourMainJar.jar" download="eager"/> ?
 
B

Bent C Dalager

Is this a feature? Is there a work-around?

I think it's an artifact of a different feature. In short, if you do
not specify a main-class in the jnlp file, jws will use the main-class
it finds in the manifest file of the first jar file in the resource
section. This is all well and nice of course, but it appears to me to
have the side effect that even if you _do_ specify a main-class, it
still only looks for it in the first jar file.

I wrote my own ANT task to sort the file names with my main jar on
top.

Cheers
Bent D
 
T

Tarlika Elisabeth Schmitz

Hello Andrew,

Andrew said:
Untested.. have you tried..
<jar href="YourMainJar.jar" download="eager"/> ?

Tried it but it doesn't make a difference. My understanding is the
default is "eager" anyway. Also, I cannot specify it in the Ant task
when using fileset to produce the "resources" section.

--


Regards/Gruß,

Tarlika
 
T

Tarlika Elisabeth Schmitz

Hello Bent,
I think it's an artifact of a different feature. In short, if you do
not specify a main-class in the jnlp file, jws will use the main-class
it finds in the manifest file of the first jar file in the resource
section. This is all well and nice of course, but it appears to me to
have the side effect that even if you _do_ specify a main-class, it
still only looks for it in the first jar file.

I tried it with and without main-class specification in the Manifest
file. Same difference. Scunner. That really renders my JNLP Ant task
nearly useless.
I wrote my own ANT task to sort the file names with my main jar on
top.

This seems crazy, just because WS is too stupid to search through the
resources list? I don't understand where the problem is: after all,
java.exe doesn't require the jars in the classpath to be in any specific
order either.

--


Regards/Gruß,

Tarlika
 
T

Tarlika Elisabeth Schmitz

Hello Bent,
Just detected :

<jar href="app.jar" main="true"/>
The "main" attribute gets WebStart to look for the main class in this
jar far file regardless whether it's at the top or not.

FOr my JNLP Ant task that means: I can still use fileset but I
additionally specify <jar href="app.jar" main="true"/> in the resources
section. WebStart doesn't care if you've got more than one entry for the
same jar.

--


Regards/Gruß,

Tarlika Elisabeth Schmitz
 
T

Tarlika Elisabeth Schmitz

Hello Andrew,

Andrew said:
I could find no reference to that in the docs I was looking at..
<http://java.sun.com/j2se/1.4.2/docs/guide/jws/developersguide/syntax.html>

How did you discover that solution?

Right enough - I never saw this in any of the Java WebStart docs I found
on the net.

I just looked through the the Roxes JNLP Ant task documentation again to
get some ideas and lo and behold, they described the "main" attribute:
"The main attribute of a jar element indicates whether this element
contains the main class (true | false)." Voilà. And that's what it
generates.

You learn something new every day.

--


Regards/Gruß,

Tarlika
 
A

Andrew Thompson

I just looked through the the Roxes JNLP Ant task documentation ...

Aha!

I am a little perturbed that this is not in Sun's own docs..
It makes me wonder if they do 'not support' this functionality that
they reserve-the-right-to-change-at-any-time *.

* Pure speculation on my part
You learn something new every day.

It would be boring otherwise. :)

Thanks for getting back to us.
 
T

Tarlika Elisabeth Schmitz

Andrew said:
Thanks for getting back to us.

I *always* post the results [or my own answers if need be ;-)].
I find that's the only justification for utilizing other people's help.
Plus there is nothing more annoying than finding someone with the same
problem in the archive but no solution.

--


Best Regards,

Tarlika
 
A

Andrew Thompson

Andrew said:
Thanks for getting back to us.

I *always* post the results [or my own answers if need be ;-)].

From what I've read of your posts, I am not surprised that you did.
I find that's the only justification for utilizing other people's help.

Excellent point.
Plus there is nothing more annoying than finding someone with the same
problem in the archive but no solution.

How about... "Thanks anyway - solved it." ;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top