473,388 Members | 870 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

SplashScreen.getSplashScreen returns null

myusernotyours
188 100+
Am trying to create a splash screen using the SplashScreen class.
i edit the manifest file to be put in to the jar file and also put the .gif file in the application directory but the method returns null all the time.
Should the .gif file be inside the jar and how do i get it there. Am using netbeans 6 and it automatically builds the jar.
Apr 4 '08 #1
7 9562
BigDaddyLH
1,216 Expert 1GB
In this article:

http://java.sun.com/developer/techni...res/index.html

It notes:

f your application is packaged in a JAR file, use the SplashScreen-Image option in a manifest file. Place the image in the JAR archive and specify the path in the option. For example, use this code in the manifest.mf file:
Manifest-Version: 1.0
Main-Class: SplashTest
SplashScreen-Image: filename.gif
You should put your image in the jar in the same want you put other resources in the jar. I don't know how netbeanz does this, I always do this by hand or with ant. This might help:

http://java.sun.com/docs/books/tutor...jar/index.html
Apr 4 '08 #2
myusernotyours
188 100+
Can someone then help with how to add files to the jar in netbeans. I have no idea how its done with ant or by hand. I am using netbeans for all my development.
Apr 5 '08 #3
myusernotyours
188 100+
In this article:

http://java.sun.com/developer/techni...res/index.html

It notes:

f your application is packaged in a JAR file, use the SplashScreen-Image option in a manifest file. Place the image in the JAR archive and specify the path in the option. For example, use this code in the manifest.mf file:
Manifest-Version: 1.0
Main-Class: SplashTest
SplashScreen-Image: filename.gif
You should put your image in the jar in the same want you put other resources in the jar. I don't know how netbeanz does this, I always do this by hand or with ant. This might help:

http://java.sun.com/docs/books/tutor...jar/index.html

Thanks
But I need to know how to do it in netbeans coz its what i use for all my development.

regards.
Apr 5 '08 #4
myusernotyours
188 100+
Now I managed to put the image in to the jar in netbeans - just put the image in the src folder and build, but the method still returns null. I also edit the manifest correctly. Any ideas?
Apr 7 '08 #5
pronerd
392 Expert 256MB
Now I managed to put the image in to the jar in netbeans - just put the image in the src folder and build, but the method still returns null. I also edit the manifest correctly. Any ideas?
Have you verified what path is being used to access the image? Either with your debugger, or a system.out.print call?
Apr 7 '08 #6
BigDaddyLH
1,216 Expert 1GB
Now I managed to put the image in to the jar in netbeans - just put the image in the src folder and build, but the method still returns null. I also edit the manifest correctly. Any ideas?
You have to realize that the path passed to the getResource method is a path.

If the class file and the image file are in the same "directory" in the jar you can write:
Expand|Select|Wrap|Line Numbers
  1. URL url = this.getClass().getResource("image.jpeg");
But suppose the class file is located in the jar in "/com/acme/widgets/Foo.class" and the image is in "/resources/pics/image.jpeg". In that case a "absolute" path in the jar makes more sense:
Expand|Select|Wrap|Line Numbers
  1. URL url = this.getClass().getResource("/resources/pics/image.jpeg");
I can't say more because you haven't given any details.

One more thing: paths in jars are case sensitive, even in Windows!
Apr 7 '08 #7
myusernotyours
188 100+
Thanks Guys, it works. But only when i click on the jar. On netbeans, it still returns null, can u think of a way to make it run from the ide?

Kind regards
Apr 8 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Rene van Hoek | last post by:
Hi, I am using Xalan 1.8.0 and Xerces 2.6.0 in C++. I have an XML document which I first transform into an other XML document using an XSL styelsheet. Then I want to parse with XPathEvaluator...
1
by: Suresh | last post by:
Hi, I have an C# CSEXE.exe (CSexe.cs) and a CSDll.dll (CSdll.cs). exe is compiled with a reference to dll. Calling for the class Type defined in CSDLL.dll using Type.GetType(...
2
by: Jeff Adams | last post by:
I am using MSVC .NET to create a C program. I am having trouble creating a window. The createwindow returns NULL however no error is caught. The GetLastError() returns "operation completed...
3
by: Zoury | last post by:
Good day! :O) I have the following code : //*** using System; using System.Windows.Forms; <snip>
8
by: Brian | last post by:
This is causing me to not be able to create a relation in my dataset. Here's my code: dc1 = ds.Tables .Columns ; dc2 = ds.Tables .Columns ; dr1 = new System.Data.DataRelation...
0
by: Zean Smith | last post by:
I am trying to get my C# client to connect to a 3rd Perl Web Service (SOAP Lite), this is the code that fails ...... object results = this.Invoke("getGrossData", new object {week} ); return...
11
by: MLH | last post by:
I have 2 lines in a procedure that assign MyVariant a value - line #238 and line #491. When line #238 runs, the value is 152. When line #491 runs, the DLookup function returns Null. I would expect...
1
by: js | last post by:
I am using the following C# code and T-SQL to get result object from a SQL Server database. When my application runs, the ExecuteScalar returns "10/24/2006 2:00:00 PM" if inserting a duplicated...
6
by: Peter Michaux | last post by:
Suppose I have implemented a language with garbage collection in C. I have wrapped malloc in my own C function. If malloc returns NULL then I can run the garbage collector and then try malloc...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.