-1

I created a jdbc connectivity project that i wanted to transfer from my laptop to another. I successfully transferred the mysql databases but on transferring the java file i get the error

    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at javax.swing.ImageIcon.<init>(ImageIcon.java:217)
at PRO.initComponents(**PRO.java:80**)
at PRO.<init>(**PRO.java:8**)
at PRO$3.run(**PRO.java:156**)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

BUILD SUCCESSFUL (total time: 8 seconds)

on clicking (PRO.java:8) It takes me to the code

       jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/PIC/STORY13.jpg"))); // NOI18N

on clicking (PRO.java:8) It takes me to the code

        public PRO() {
    initComponents();
    this.setLocationRelativeTo(null);//
}

on clicking (PRO.java:156) It takes me to the code

       public void run() {
            new PRO().setVisible(true);
        }

PS: the whole jdbc project works on my laptop perfectly. But on doing the transferring again , the same error pops up.

Namita Geo.
  • 1
  • 1
  • 5
  • I would start by looking what the PRO class in line 80. And I would rename the class to have a meaningful name. And I would not expect that anybody could help me with a code problem without showing code (see [mcve]). – GhostCat Jan 03 '19 at 06:17
  • @GhostCat i have done what you said.. you can scroll down . Please do tell me what is wrong! i have to submit my project next week. – Namita Geo. Jan 16 '19 at 19:35
  • You already got an answer: most likely, `getClass().getResource("/PIC/STORY13.jpg")` returns NULL, leading to NPE. so: that resource lookup fails on that other platform. Exactly like the answer you got 13 days ago suggests. Beyond that, honestly: you come back after 13, and now you are in a hurry? The help center explicitly states that people should be around when asking questions. It isn't exactly polite to drop a question, and to then walk away for multiple days. Hint: if your priorities are that tight ... then follow them up on time, and not 5 minutes before the assignment is due. – GhostCat Jan 16 '19 at 20:05

1 Answers1

2

This is not due to any jdbc problem, this is because it's looking for some image you used in your project that is missing from the machine you transferred to.

adn.911
  • 1,256
  • 3
  • 17
  • 30