-1

I'm a long time reader, first time poster.

I use Netbeans to develop a Java application to run some simulations in regard to Project Management. Now the program is finished, I want to make a JAR file of it so other team members can use it without installing Netbeans. Normally I just press "build and clean" to make a JAR file but this trick ain't working this time. When I run the JAR file everything works fine until I press the button to start the simulations. Next error is given on the command line in cmd:

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: optimizat
ion/Lmder_fcn
        at umontreal.iro.lecuyer.randvar.BetaGen.nextDouble(BetaGen.java:109)
        at Scheduling.SimulationEngine.randomizeDurations(SimulationEngine.java:
122)
        at Scheduling.SimulationEngine.simulateNew(SimulationEngine.java:73)
        at IO.FileReader_GUI$GUIEventHandler.actionPerformed(FileReader_GUI.java
... blablabla

Point given is that the umontreal.iro.lecuyer.randvar.BetaGen.nextDouble() method is a static method used from a JAR file I added to my project. In Netbeans it doesn't bring any problems but it does when I use run it 'stand-alone' without Netbeans.

Can somebody please give me a quick solution? Please keep in mind that I'm not a professional programmer. Do not hesitate to ask questions if you need more information!

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Drizzt
  • 133
  • 1
  • 2
  • 7
  • 3
    *"Can somebody please give me a quick solution?"* Hire a consultant at 'urgent' rates. – Andrew Thompson Dec 13 '12 at 14:02
  • How do you run the jar file? If you are using "java -jar myjar.jar" from the command line, remember to include the other jars in your classpath. – cmonkey Dec 13 '12 at 14:05
  • 2
    *long time readers* should create an account, get 15 rep points as quick as possible and start upvoting the questions and answers that helped them. IMHO. – Andreas Dolk Dec 13 '12 at 14:10
  • 1
    Your problem is that your exported JAR does not contain the required dependencies. You can start reading [here](http://stackoverflow.com/questions/9722257/building-jar-that-includes-all-its-dependencies) for some possible solutions. – Perception Dec 13 '12 at 14:19
  • @Perception, I've read the link, thank you. – Drizzt Dec 15 '12 at 12:14

1 Answers1

1

It seems pretty clear that your JAR is not in the class path. Please read this tutorial, it should help you figure out your problem in your environment.

PATH and CLASSPATH (The Java™ Tutorials > Essential Classes > The Platform Environment)

Also, in the comments @Perception included a great link that might also help you, I want to make sure you see it.

Community
  • 1
  • 1
durron597
  • 31,968
  • 17
  • 99
  • 158