Main class not found
I have an application where the main class attribute is specified in the application-desc tag.
When the jar containing this class is referred to from an extension location (using the extension tag in resources) jnlp complains that the class can not be found.
Is this use case supported, is there a trick to get that to work?
Thx.
Note that if I list my jar in the main jnlp file then it works, but I would like to get the other one working for cleanliness.
# 1
I am not sure of the answer to your question, however I
struck a 'similar problem, in the opposite direction'.
There was a main defined in an existing Jar that
I wanted to use as a common library, but when refered
to as such, the main was not findable.
The only thing I could think of, to 'have my cake
and eat it too', was to (perhaps*) extend the class
with a main(), then include the extended class
along with my own jar.
2 notes.
- * I had not got around to testing this idea.
- I do not like having to extend the class
with a main(), just so I can invoke the
extended class from somewhere else -
it wreaks of bad design.
I cannot see any logical, technical or security
reason why this should be the case, though,
and would be interested in hearing from the
gurus as to what the actual rules and logic are.
# 2
> I am not sure of the answer to your question, however I
> struck a 'similar problem, in the opposite direction'.
Now I reread your original description, I think
that comment was wrong - & we were trying
the exact same thing..
I originally thought you meant that the code in
the library extension was attempting to call a
main() specified in a class that was contained
in a jar mentioned in the resources of the root
JNLP file! (Phew - time to pause - inhale..)
Now - that makes no sense to me at all, and
I am tending to think you were doing it the
same way I tried.
# 3
Just to clarify / confirm. The application description tag in my main jnlp file refers to a class contained in an extension location. In fact my whole application is in an extension location.
# 4
I no jar file listed in the main jnlp file contains the main="true" attribute, Java Web Start will assume the first listed jar file contains the main jar.
Currently, Java Web Start dosn't seem to support a main jnlp file with no jar resources, though I think it should, and will look into adding this capability.
/Andy
# 5
It seems like what you are suggesting, might
support the OP's use case, but not my own.
To explain more fully. The 'library' would be
the SaverBeans API, which contains the
ScreensaverFrame (SSF), which has a main().
OTOH, the actual class loaded by the main(),
would be a screensaver class, contained in a
jar in the main JNLP. The screensaver class
name is given to the SSF as an argument to
main(), SSF then loads it using reflection.
So this is a situation where ..
- there are jar(s)* in the main JNLP, related to
the screensaver itself.
- * none of which has a main='true'
- the main is in a jar mentioned in the library
JNLP.
Any chance that use case can also be
accommodated? (Or did I understand
you wrong?)
# 6
It would be good if this scenario could be added to jws since without it jnlp misses on component reusability.