The application runs from netbeans, but not the command-line

Hi
I have developed a GUI application using NetBeans. All source code files are compiling without problems and the program runs just fine when i press "run <app name>" in NetBeans. However, when i try to execute the jar file using the command "java -jar <name of jar>", then i get this error message (im standing in the same directory as the jar file which is the dist directory:
$ java -jar /home/icebyte/NetBeansProjects/TripPlanner/dist/TripPlanner.jar
Exception in thread "main" java.lang.NoClassDefFoundError: tripplanner/Main
Caused by: java.lang.ClassNotFoundException: tripplanner.Main
at java.net.URLClassLoader$1.run(URLClassLoader.java:221)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:209)
at java.lang.ClassLoader.loadClass(ClassLoader.java:324)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:269)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:337)
Error: Could not find the main class.
Error: A JNI error has occurred, please check your installation and try again
Does someone know why i am getting this error ? I would be nice to find out. I have also tried to go into the src directory of the netbeans project and compile all files there which works fine, but when i try to run the program with "java <file that contains main method>" i get this error:
Exception in thread "main" java.lang.NoClassDefFoundError: MainMenu (wrong name: tripplanner/MainMenu)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:638)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:143)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:281)
at java.net.URLClassLoader.access$000(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:216)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:209)
at java.lang.ClassLoader.loadClass(ClassLoader.java:324)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:269)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:337)
Error: Could not find the main class.
Error: A JNI error has occurred, please check your installation and try again
I have JDK and JRE installed on the system (it came with netbeans). I have tried setting the JAVA_HOME variable, but there is no difference. Anyone? Thanks for all help.

Hmm, i solved the problem now. I looked at this problem yesterday and couldnt find out why i was getting these stack traces, but now i know :)

Similar Messages

  • My email only shows the "to" and "from" info but not the content of the email. Please help. Thanks

    My email only shows the "to" and "from" info. There is no information at all in the body of my email messages. Please help. Thanks.

    Close the mail app and reboot the iPad.
    Tap the home button once. Then tap the home button twice and the recents tray will appear at the bottom of the screen. Tap and hold down on any app icon until it begins to wiggle. Tap the minus sign in the upper left corner of the mail icon. Tap the home button twice.
    Reboot the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider if it appears on the screen - let go of the buttons. Let the iPad start up.

  • I bought Mountain LIon but no dmg is downloaded. I can see the invoice from Apple but not the OS I supposed to receive. Is it a bugg?? I have a mac book air. Thanks

    xI bought Mountain LIon but no dmg is downloaded. I can see the invoice from Apple but not the OS I supposed to receive. Is it a bugg?? I have a mac book air. Thanks

    Thanks for the reply.
    However the trick is that it cannot download at all.I m asked to download the application. Then I put my Apple ID, then it start to download but just 1s... Then ....Nothing. No application, no error message... Just a nice invoice....

  • Allt he links in the header of any websites are not working, I reinstalled fiorefix and it s the same. No problem in others browser. the tool bar is working but not the link sinside the web page located between the top 300px height

    all the links in the header of any websites are not working, the cursor is not changing into pointer and no way to click on any link located at the top of any website page. I reinstalled firefox and it s the same. No problem in others browser. the tool bar is working but not the links inside any web page located between the top 300px height.
    So I can t tlog into any website, i cant write an email as the compose button is located in the top of the page.. Please help, i have all my bookmarks into my firefox...

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

  • Why can't I save text I've entered into a PDF file?  When I hit "Save As", only the PDF document is saved, but not the text i typed into the document.  I'm using Windows 8.

    Why can't I save text I've entered into a PDF file?  When I hit "Save As", only the PDF document is saved, but not the text i typed into the document.  I'm using Windows 8.

    THANK YOU!
    Jan Whitfield
    The College Planning Center
    250 Palladio Parkway, Suite 1311
    Folsom, CA 95630
    (916) 985-0453
    www.TheCollegePlanningCenter.com

  • TS1389 Trying to play purchased TV series to my Apple TV, I am requested to authorise the computer.  This has already been done and I have tried the suggestions regarding authorisation.  I can play the programs on my computer, but not the Apple TV.

    Trying to play purchased TV series to my Apple TV, I am requested to authorise the computer.  This has already been done and I have tried the suggestions regarding authorisation.  I can play the programs on my computer, but not the Apple TV.
    Any ideas?

    in remote app click on the
    lower left corner on the text
    top of the context menu click devices
    choose the appletv rather then your shared lib in the list
    if you are trying to view a movie that is located on your ipad on your tv using the appletv then
    you should use airplay mirror not the remote app

  • I recently changed my PC and I transferred my iTunes music library to an external disc. Now, when I open iTunes I can only see the music I've downloaded, but not the rest of my music. Whatdo I need to do?

    I recently changed my PC and I transferred my iTunes music library to an external disc. Now, when I open iTunes I can only see the music I've downloaded, but not the rest of my music. What do I need to do?

    PDMex wrote:
    I recently changed my PC and I transferred my iTunes music library to an external disc.
    Did you transfer the entire /Music/iTunes/ folder?
    Or did you only transfer /Muisic/iTunes/iTunes media? folder?

  • Application works from NB but not from jar

    Hi,
    I'am programming a game in JAVA and this going as planned. Everything works when I run it from NetBeans, but when I execute the jar file from the console, then I get hunderds of the same exception.
    I really don't know what it is, I see a NoSuchMethod exception in the MouseEvent of the method getLocationOnScreen(), but just as i said, the app works fine without errors from out NB.
    Does somebody knows what the problem is?
    thx Sven
    java -jar Hotel.jar
    Loading board images.
    Loading image: /Images/bg-patern-hotel.jpg
    Opening file /Images/bg-patern-hotel.jpg file exisits: true -- [/Users/svenvanzoelen/NetBeansProjects/Games/Hotel/dist/Images/bg-patern-hotel.jpg]
    Loading image: /Images/Main-board-big.jpg
    Opening file /Images/Main-board-big.jpg file exisits: true -- [/Users/svenvanzoelen/NetBeansProjects/Games/Hotel/dist/Images/Main-board-big.jpg]
    Exception in thread "AWT-EventQueue-0" java.lang.NoSuchMethodError: java.awt.event.MouseEvent.getLocationOnScreen()Ljava/awt/Point;
         at Engine.GameAction.setMousePos(GameAction.java:137)
         at Engine.InputManager.mouseMoved(InputManager.java:277)
         at java.awt.Component.processMouseMotionEvent(Component.java:5647)
         at java.awt.Component.processEvent(Component.java:5371)
         at java.awt.Container.processEvent(Container.java:2010)
         at java.awt.Window.processEvent(Window.java:1184)
         at java.awt.Component.dispatchEventImpl(Component.java:4068)
         at java.awt.Container.dispatchEventImpl(Container.java:2068)
         at java.awt.Window.dispatchEventImpl(Window.java:1801)
         at java.awt.Component.dispatchEvent(Component.java:3903)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
    Same error goes 50 times more.Edited by: Svenmeister on Apr 16, 2010 7:22 AM
    Edited by: Svenmeister on Apr 16, 2010 7:22 AM

    Ok, I updated my Mac but still got the 1.5.0_22 crap so I changed the function from the mouseEvent to one that 1.5 supports.
    But now when I run the application from the console the Exception about the mouse function is gone, but I got another exception instead of it. And this one is I believe not JRE version relevant.
    The error is in the loading of the images, at the third PNG image to be precise. The images are now in total 10.8MB in size.
    So is this also a 1.6 thing? Would be awesome if someone can explain it.
    java -jar Hotel.jar Loading board images.
    Exception in thread "Image Fetcher 0" java.lang.OutOfMemoryError: Java heap space
         at java.awt.image.DataBufferInt.<init>(DataBufferInt.java:41)
         at java.awt.image.Raster.createPackedRaster(Raster.java:458)
         at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1015)
         at sun.awt.image.ImageRepresentation.createBufferedImage(ImageRepresentation.java:223)
         at sun.awt.image.ImageRepresentation.setPixels(ImageRepresentation.java:469)
         at apple.awt.OSXImageRepresentation.setPixels(OSXImageRepresentation.java:66)
         at sun.awt.image.ImageDecoder.setPixels(ImageDecoder.java:120)
         at sun.awt.image.PNGImageDecoder.sendPixels(PNGImageDecoder.java:498)
         at sun.awt.image.PNGImageDecoder.produceImage(PNGImageDecoder.java:419)
         at sun.awt.image.InputStreamImageSource.doFetch(InputStreamImageSource.java:246)
         at sun.awt.image.ImageFetcher.fetchloop(ImageFetcher.java:172)
         at sun.awt.image.ImageFetcher.run(ImageFetcher.java:136)
    Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
         at java.awt.image.DataBufferInt.<init>(DataBufferInt.java:41)
         at java.awt.image.Raster.createPackedRaster(Raster.java:458)
         at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1015)
         at java.awt.image.BufferedImage.<init>(BufferedImage.java:345)
         at apple.awt.CGraphicsConfig.createCompatibleImage(CGraphicsConfig.java:174)
         at GUI.Board.toBufferedImage(Board.java:1472)
         at GUI.Board.loadImages(Board.java:1143)
         at Engine.HotelMain.switchState(HotelMain.java:86)
         at Engine.HotelMain.<init>(HotelMain.java:57)
         at Engine.HotelMain.main(HotelMain.java:194)Edited by: Svenmeister on Apr 16, 2010 11:01 AM

  • I have made a webpage in HTML with several links to JPGs / GIFs. The text matter opens perfectly but not the images. Please help me

    I have made a web page in HTML with several links to JPGs / GIFs. While text matter opens up perfectly, but not the images. Please help me.
    == This happened ==
    Every time Firefox opened
    == User Agent ==
    Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; CTS Version; .NET CLR 1.1.4322; .NET CLR 2.0.50727)

    URL of that web page?

  • I can save the USA Paper as PDF, but not the Denver Post

    I can save the USA Paper as PDF file, but not the Denver Post.
    I currently have 4.0.1 firefox.

    When you select save PDF on your PlayBook and nothing happens. On ly up Adobe Reader on the PlayBook and see if they are in there

  • Program run in Netbeans but NOT running as jar file

    Dear all ,
    i hope any help in this problem.
    i am writing program to access parallel port i put next files :
    1. [ comm.jar + javax.comm.properties ] in
    [ C:\Program Files\Java\jdk1.6.0_18\lib ] and [ C:\Program Files\Java\jdk1.6.0_18\jre\lib ]
    2. [ win32com.dll ] in [ C:\WINDOWS\system32 ]
    when i run application in NetBeans IDE 6.8 work fine and every think is ok
    BUT when i produce jar file , generated jar file does not work [GUI appear but can not get ports on PC]
    - I try to set Environment Variable as next :
    CLASSPATH = .;C:\Program Files\Java\jdk1.6.0_18\lib\comm.jar
    also does not work
    any tip please ?
    Thanks in advance
    Nabil

    First of all, leave the lib and jre/lib directories of the JRE alone. Never ever touch them again. Remove any jars you have put there yourself, or better yet completely remove and reinstall the JRE to make sure you put it back in a correct state.
    After you do that, learn how to properly work with the classpath in both the IDE and the command line.
    Netbeans: you define the classpath by adding jars to the project (right click on the libraries node in the project tree to get the appropriate options).
    Command line: this depends on if you run a single class, or you invoke an executable jar.
    Single class: you use the -cp command line switch to define the classpath
    Executable jar: the jar itself defines the classpath in its META-INF/manifest.mf file. The -cp command line switch is ignored.
    Since you use Netbeans, you'll get an executable jar so make sure to learn how such a jar is structured.

  • How do I backup the *contents* of a sparseimage (but not the actual image)?

    This is related to my iPhoto question:
    http://discussions.apple.com/thread.jspa?threadID=2590319
    I'd like to backup the contents of a sparseimage using TM. If I just point TM to the imagefile, I run in to the issue that each time I add/modify a file inside the image, then TM marks the whole image as changed and hence backs it all up. And since the image is large I run out of diskspace.
    Is there some way I can just back up the contents of the image? If my sparse image file is:
    /Users/shared/foo.sparseimage and it gets mounted as:
    /Volumes/foo
    is there someway I can point TM to /Volumes/foo and then exclude TM backing up /Users/shared/foo.sparseimage (I know how to do the latter).
    Thanks in advance.

    each time I add/modify a file inside the image, then TM marks the whole image as
    changed and hence backs it all up. And since the image is large I run out of
    diskspace.
    If you use a sparsebundle disk image instead of a sparseimage, that shouldn't happen.
    From this article
    [Discovering Sparse Bundle Disk Images|http://db.tidbits.com/article/9673]:
    A sparse bundle looks and acts just like a sparse image - it can grow in size, can optionally be compressed or encrypted, and so on. What's different is that it isn't actually a single file, as all previous disk image formats were. It's a bundle (also known as a package) - a folder that Mac OS X treats as a single file, which is also true of applications. (To verify this, you can Control-click or right-click a sparse bundle, choose Show Package Contents from the pop-up menu, and browse through its contents.) Inside that package is a folder full of bands - files that are each 8 MB in size, as many as are needed to hold the image's data.
    What's cool about this is that if you change something on a sparse bundle (adding or modifying a file, for instance), only the band(s) containing that data change, not the whole bundle. As a result, assuming your backup software treats the contents of bundles as individual files, you no longer have to back up a huge disk image just because a tiny file changed. Your backup software only has to copy the 8 MB band(s) containing any of that file's data (often only one). So I converted my encrypted sparse image to an encrypted sparse bundle, and now I can include it along with all my other files in my ordinary backups.
    ---------------------

  • Is there a way to display the legend for a chart, but not the chart?

    Hi,
    I have a stacked column chart and a line chart on top of each other.   I can't use the legend for the stacked column chart because the data will change from month to month, and the 2 charts will not be aligned.  I copied the stacked column chart to another part of the canvas and want to display only the legend, but the chart is still displaying.  Is there a way to prevent the chart from displaying?    Thanks.

    hi Jim Wojewnik,
    we can show only the legend in a pie chart by dragging the edges to closer.do the following,
    select the pie chart,select the edge of the chart and make it small and u ll find the pie chart shrinking.make it lean such that the pie chart disappear.
    try this work around and let me know.
    regards,
    ravi.

  • My hp touch pad wont charge. the cord charges my phone but not the pad.

    the usp port got bent and I wrapped the cord around the device to provide contact but now nothing.  any remedy?  is there another way to charge it?

    If the port of the TouchPad won't allow for proper contact, your best option is to use a Touchstone charger.  Mine works great.  They are no longer available directly from HP, but check with third-party sellers like Amazon, eBay, or webOSNation.com
    smkranz
    I am a volunteer, and not an HP employee.
    Palm OS ∙ webOS ∙ Android

  • ITunes is playing the audio on my movies but not the video.

    I have the latest version of iTunes along with Windows 8 and for some reason iTunes will not play the video part of my movies, just the audio. The screen appears as black when I try.

    Which encoding is used on that site?
    *Firefox > Web Developer > Character Encoding
    *View > Character Encoding
    For me the windows-1252 encoding is selected.

Maybe you are looking for