Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 570
  • Last Modified:

JNLP error

hello there,

i am trying to run my application using jnlp.but i get this error in the console.i can run the application with jar but with jnlp i get this error.please help.

Exception in thread "Thread-17" java.lang.NullPointerException
      at javax.swing.ImageIcon.<init>(Unknown Source)
      at com.FrmSplash.run(FrmSplash.java:11)
      at java.lang.Thread.run(Unknown Source)
0
zolf
Asked:
zolf
  • 3
  • 2
1 Solution
 
zolfAuthor Commented:

the line 11 is shown below
JLabel SplashLabel = new JLabel(new ImageIcon(ClassLoader.getSystemResource("images/Splash Screen 2.jpg")));
public void run()
	{
		JLabel SplashLabel = new JLabel(new ImageIcon(ClassLoader.getSystemResource("images/Splash Screen 2.jpg")));
		Dimension screen = 	Toolkit.getDefaultToolkit().getScreenSize();
		

Open in new window

0
 
humanonomicsCommented:
it seems, your application is is not picking up the image file and hence "ClassLoader.getSystemResource("images/Splash Screen 2.jpg")" returns null, which results in that exception.
0
 
zolfAuthor Commented:

what do i need to do.please help.below is my jnlp file.the application runs fine using java -jar erp.jar
<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="file:///C:/JNLP/">
<information>
  <title>Time Check</title>
  <vendor>Java Developer Connection</vendor>
  <homepage href="/jdc" />
  <description>Demonstration of JNLP</description>
</information>
<offline-allowed/>
<security>
  <all-permissions/>
</security>
<resources>
  <j2se version="1.2+" />
  <jar href="erp.jar"/>
  <jar href="looks-2.2.0.jar"/>
  <jar href="sqljdbc.jar"/>
  <jar href="calendar-0.10.jar"/>
  <jar href="commons-collections-3.2.jar"/>
  <jar href="commons-logging-1.1.jar"/>
  <jar href="iText-2.1.3.jar"/>
  <jar href="jasperreports-3.0.0.jar"/>
  <jar href="jcalendar-1.3.2.jar"/>
  <jar href="looks-2.2.0.jar"/>
  <jar href="validation-2.0.1.jar"/>
</resources>
<application-desc main-class="com.MainForm" />
</jnlp>

Open in new window

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
zolfAuthor Commented:

i also removed the space between the image file name, just in case.but no luck
0
 
humanonomicsCommented:
Please give the directory structure
0
 
rrzCommented:
Did you try ?
   ClassLoader cl = this.getClass().getClassLoader();
   Icon icon  = new ImageIcon(cl.getResource("images/SplashScreen2.jpg"));
see
http://java.sun.com/javase/6/docs/technotes/guides/javaws/developersguide/development.html#retrieving
0

Featured Post

Independent Software Vendors: 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!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now