Results 1 to 4 of 4
  1. #1
    jpmaia is offline Member
    Join Date
    Apr 2010
    Posts
    2
    Rep Power
    0

    Default GUI app works in NetBeans, doesn't from command line

    I'm using NetBeans 6.8, under Windows XP Professional V 2002 SP 2.

    I've developed a simple data file editor using the NetBeans graphical GUI Designer. I started by creating a new project and choosing a Java Desktop Application. I have been using the classes that were auto-generated, with all my changes going into the myappView.java class.

    This application works just fine when I run it within NetBeans, but does not work when I attempt to run it at the command line using the generated jar file in "dist". I also attempted to write a command line script file. Whether I run this script at the command line, or double-click it in the Windows Explorer window, or run the java command directly, I encounter the same problem.

    I've tried the java command listed in the README file NetBeans provides in "dist". I've tried adding a classpath to the java command including the two gui framework libraries that NetBeans includes in the "dist\lib" directory. Nothing works from the command line.

    I get a NullPointerException towards the top of the myappView.java class, within the auto-generated code, a couple lines after the "initComponents" method call.

    The next two lines of auto-generated code are:

    ResourceMap resourceMap - getResourceMap();
    int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout") ;

    The exception occurs on the second line.

    I have not overridden any of the methods provided by the GUI framework.

    I've searched this forum and elsewhere and have not found any solutions to this problem.

    Thank you in advance for any help you may provide. I am at a loss as to why this does not run from the command line.

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

  3. #3
    jpmaia is offline Member
    Join Date
    Apr 2010
    Posts
    2
    Rep Power
    0

    Default

    Stupid me. I inadvertently mis-edited the "Project Properties-->Packaging" page, for the field to "Exclude files from the JAR file", which resulted in the property files not being included in the JAR. I've been trying to figure out the problem since yesterday.

    I should have double-checked this before, but since the application ran ok from within NetBeans I assumed the JAR was fine.

    My program now runs successfully from either the command line or from within NetBeans. Mea Culpa (however you spell it).

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

    Default

    Application deployment is something different from ordinary file execution. You have to do several things, for as example selecting the main class is one of them, if you have several packages in your project, and so on.

Similar Threads

  1. Command Line Arguments
    By Nakira in forum NetBeans
    Replies: 10
    Last Post: 02-04-2010, 03:45 PM
  2. Replies: 0
    Last Post: 10-05-2009, 11:25 PM
  3. Searching command line
    By McChill in forum New To Java
    Replies: 5
    Last Post: 02-25-2009, 06:00 PM
  4. Replies: 7
    Last Post: 12-08-2008, 06:20 PM
  5. Unable to execute command line command in java
    By LordSM in forum New To Java
    Replies: 1
    Last Post: 08-08-2007, 12:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •