File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Sockets and Internet Protocols and the fly likes Exception throwing when working with jar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Exception throwing when working with jar" Watch "Exception throwing when working with jar" New topic
Author

Exception throwing when working with jar

Abhijith Sugunan
Greenhorn

Joined: Aug 04, 2012
Posts: 10
I have created a project in netbeans with SQLite as DB.When i run it within netbeans it
works perfectly when i run the jar using "java -jar <jarname>.jar" it throws this exception


H:\>java -jar Remote_PC_Manger.jar
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at com.halorpm.main.LocalDB.checkAnonymous(LocalDB.java:74)
at com.halorpm.main.MainForm.initComponents(MainForm.java:172)
at com.halorpm.main.MainForm.<init>(MainForm.java:137)
at com.halorpm.main.Core.<init>(Core.java:32)
at com.halorpm.main.Core$3.run(Core.java:142)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Sour
ce)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)




Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

The answer is right there in the error message (and it has nothing to do with sockets).



What's line 74 of LocalDB.java?
Abhijith Sugunan
Greenhorn

Joined: Aug 04, 2012
Posts: 10
Jeff Verdegan wrote:The answer is right there in the error message (and it has nothing to do with sockets).



What's line 74 of LocalDB.java?


LocalDB ob = new LocalDB();
int res = ob.checkAnonymous();
if(res==1) {

jCheckBox1.setSelected(true);

}

Actually it's work fine in ide and i run the executable jar it throws this exception
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Which is line 74?
Abhijith Sugunan
Greenhorn

Joined: Aug 04, 2012
Posts: 10
Jeff Verdegan wrote:Which is line 74?


int res = ob.checkAnonymous()
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Abhijith Sugunan wrote:
Jeff Verdegan wrote:Which is line 74?


int res = ob.checkAnonymous()


Then ob is null.

If it works in one environment and not the other, then it's probably either a timing issue with multithreaded code, or you've tried to load a class that's not on your classpath (but was in the other environment) and have swallowed the resulting ClassNotFoundException.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Abhijith Sugunan wrote:
Jeff Verdegan wrote:Which is line 74?


int res = ob.checkAnonymous()


That line of code isn't even in LocalDB.java, at least not in the version you posted. Let's try again.

What is line 74 of LocalDB.java?
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Paul Clapham wrote:
That line of code isn't even in LocalDB.java, at least not in the version you posted. Let's try again.

What is line 74 of LocalDB.java?


Abhijith, I realize you're new to programming, so here's an important lesson. More important than learning any particular language syntax. Precision and attention to detail are cruicial.

You have to pay attention to the details of what error messages are saying, both at compile time and at runtime.

You have to pay attention to the details of what others are saying when they're making suggestions or asking you questions.

You have to be very precise in what you say to others when describing a plan or a problem.

If you don't do these things, misunderstandings--between you and others, and between you and the computer--will prevent you from making progress.
 
 
subject: Exception throwing when working with jar
 
Similar Threads
Simple Accept / Reject Dialog refuses to work
NOT Abstract ERROR
simple login - help asp
Problem adding JComboBox to JFrame
How to create hot key?