Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2007

Tip: Looking for answers? Try searching our database.

SplashScreen-Image and Libraries

Thread view: 
Jason Cavett - 28 Nov 2007 03:12 GMT
I am trying to use the SplashScreen feature in Java 6, and it works
when I use the -splash parameter passed to the JVM.  However, when I
try to use the MANIFEST file, it doesn't seem to work correctly.  I
think this has to do with the fact that the image I am trying to
access is within another directory (it's specifically in a library
that has been included in the project's classpath).  Here is my
MANIFEST file:

Manifest-Version: 1.0
Main-Class: myproject.Main
SplashScreen-Image: "resources/icons/misc_icons/Title Screen.png"
Class-Path: lib/Project_Resources.jar

resources/icons/misc_icons/Title Screen.png is found within the
Project_Resources.jar.  I have tried moving the Class-Path variable
before SplashScreen-Image but that does not seem to help the problem.

Does anybody have any suggestions?  Thanks
Knute Johnson - 28 Nov 2007 03:59 GMT
> I am trying to use the SplashScreen feature in Java 6, and it works
> when I use the -splash parameter passed to the JVM.  However, when I
[quoted text clipped - 14 lines]
>
> Does anybody have any suggestions?  Thanks

How can you have a Class-Path: of lib/Project_Resources.jar?  Is lib in
the project jar?  I don't think you can do that.  Of course I could be
totally confused :-).

Signature

Knute Johnson
email s/nospam/knute/

Jason Cavett - 28 Nov 2007 04:17 GMT
On Nov 27, 10:59 pm, Knute Johnson <nos...@rabbitbrush.frazmtn.com>
wrote:
> > I am trying to use the SplashScreen feature in Java 6, and it works
> > when I use the -splash parameter passed to the JVM.  However, when I
[quoted text clipped - 23 lines]
> Knute Johnson
> email s/nospam/knute/

Ah, yes.../lib is contained within the project JAR.  Something like
this...

Project.jar
- compiled.code.packages.and.stuff
- lib
 - Project_Resources.jar

There is a configuration file, as well as a C++ launcher to read that
configuration file outside of the Project.jar.  The C++ launcher was
created so a splash screen could be shown, but now that Java does it,
I think I can get rid of the C++ launcher if I can figure out this
problem.
Lew - 28 Nov 2007 04:46 GMT
>>> MANIFEST file:
...
>>>  Class-Path: lib/Project_Resources.jar

Knute Johnson wrote:
>> How can you have a Class-Path: of lib/Project_Resources.jar?  Is lib in
>> the project jar?  I don't think you can do that.  Of course I could be
>> totally confused :-).

The manifest Class-Path entry refers to a JAR on the local (i.e., deployment)
platform, not within the JAR whose manifest this is.  In other words, the
referenced JAR is external to the referencing JAR.

> Ah, yes.../lib is contained within the project JAR.

The manifest file's Class-Path entry does not refer to directories within the JAR.

<http://java.sun.com/docs/books/tutorial/deployment/jar/downman.html>
> Note : The Class-Path header points to classes or JAR files on the local network,
> not JAR files within the JAR file or classes accessible over internet protocols.
[quoted text clipped - 3 lines]
> you cannot use the Class-Path header in MyJar.jar's manifest to load classes
> in MyUtils.jar into the class path.

Signature

Lew

Jason Cavett - 28 Nov 2007 13:38 GMT
> >>> MANIFEST file:
> ...
[quoted text clipped - 24 lines]
> --
> Lew

Wow.  I can't believe I made that beginner mistake (already knew that
too - /lib/Project_Resources.jar exists outside my Project.jar).

Anyway, it seems like from Owen's response, there's no way for the
classloader to know about files in other JARs, so I have to put the
splashscreen image within my main JAR file.

Alright, thanks for the help everybody.
Owen Jacobson - 28 Nov 2007 04:49 GMT
> On Nov 27, 10:59 pm, Knute Johnson <nos...@rabbitbrush.frazmtn.com>
> wrote:
[quoted text clipped - 39 lines]
> I think I can get rid of the C++ launcher if I can figure out this
> problem.

The built-in classloaders in general can't look inside JARs that are
inside JARs.  Your Class-Path attribute instead specifies
Project_Resources.jar in the directory lib in the same directory the
Project.jar is in, like so:

foo/
 foo/Project.jar
 foo/lib/
   foo/lib/Project_Resources.jar

It's not terribly hard to write your own classloader that can look
inside a JAR for JARs, but it won't be availalble until after the
splashscreen-displaying code in the JRE has already run.  You'll have
to restructure your packaging to use the built-in splash screen.

-O


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.