0

I am working on fixing the bugs in a pre written java/swing application. Now that all bugs are gone I create a jar of the application to distribute it and the jar doesn't run.

Both classpath file looks the same, the one in eclipse with the one in jar. No luck :( I hardcoded the path to all .jar files in the manifest file, Still didn't work !

Is there anything else I should be checking as well ? Any help is greatly appreciated. I hate to resort to the last solution of making the testers run the app from eclipse. Let me know if If any of the files/code you want me to post here.

Thanks in advance.

  • When you say the jar doesn't run, do you mean it throws some kind of error when you try to run it through the command line or it simply does nothing at all when executing? – Surveon Nov 01 '13 at 14:46
  • Yes, Sorry I should have mentioned, I get java.lang.ExceptionInInitializerError . And Yes I used command prompt to run the jar and I actually know where it is failing. So I thought jar is not able to find the particular .jar file. – user2933333 Nov 01 '13 at 14:51
  • You can have a look at http://stackoverflow.com/questions/3375810/exception-in-initializer-error – Alireza Fattahi Nov 01 '13 at 14:54

3 Answers3

0

I think you need to set your classpath, especially add a ' .;' to your classpath

(The dot means the current dirctory)

StackBox
  • 326
  • 1
  • 6
0

If you're running the jar from the command line you need to use the command

java -jar MyJar.jar

You've not put the error message you were getting or how you were trying to run the jar, but if it was from the command line and you were getting an error like could not find or load main class then missing the -jar flag will do that. I had the same thing happen to me earlier today. I created a runnable jar from eclipse and didn't have to modify it in anyway to make it run like that.

Choc13
  • 796
  • 7
  • 23
  • Exception in thread "Thread-3" java.lang.ExceptionInInitializerError at com.documentum.fc.client.DfClient.(DfClient.java:697) at com.documentum.com.DfClientX.getLocalClient(DfClientX.java:43) at dst.proc.DocumentumImageLoader.createSessionManager(DocumentumImageLoader.java:97) at dst.proc.DocumentumImageLoader.loadImages(DocumentumImageLoader.java:53) at dst.proc.CreateDocumentumDataProc.load(CreateDocumentumDataProc.java:114) – user2933333 Nov 01 '13 at 15:21
  • at dst.controllers.DocumentumController$1.run(DocumentumController.java:43) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.NullPointerException at com.documentum.fc.client.security.impl.IpAndRcHelper.getRegistration(IpAndRcHelper.java:439) at com.documentum.fc.client.security.impl.DfcIdentityPublisher.getRegistration(DfcIdentityPublisher.java:469) at com.documentum.fc.client.security.impl.DfcIdentityPublisher.isRegistration(DfcIdentityPublisher.java:446) at – user2933333 Nov 01 '13 at 15:21
  • com.documentum.fc.client.security.impl.DfcIdentityPublisher.publish(DfcIdentityPublisher.java:134) at com.documentum.fc.client.security.impl.DfcIdentityPublisher.publish(DfcIdentityPublisher.java:102) at com.documentum.fc.client.security.internal.RegistrationMgr.register(RegistrationMgr.java:34) at com.documentum.fc.impl.RuntimeContext.(RuntimeContext.java:191) ... 7 more – user2933333 Nov 01 '13 at 15:22
  • Now DfClientX.java comes from a jar : Dfc.jar – user2933333 Nov 01 '13 at 15:23
0

How it worked finally was to export the jar with libraries in a separate folder. It worked like a charm :) Gave the jar with the lib folder to testers and it has been working fine for few weeks now ! Thanks everyone for helping me.