Nothing happens when I execute a .jar file

Hi all,
When I compile my application in NetBeans, I get a message that says:
{color:red}To run this application from the command line without Ant, try:
java -jar "C:\Documents and Settings\rob\Desktop\Java\Projects\ChapterThreePrograms\dist\ChapterThreePrograms.jar"{color}
However, when I run that command, nothing happens. Any idea what I'm doing wrong? Below is my source code (well, the source code from my text book):
import java.awt.*;
import javax.swing.JFrame;
public class DateClient extends JFrame
  String action;
  boolean firstTime = true;
  int animationPause = 3; // 3 seconds between animations
  Date dateObj; // declare Date object reference
  public void workWithDates( )
    animate( "dateObj reference declared" );
    /***** Add your code here *****/
    /**** 1. Instantiate dateObj using an empty argument list  */
    dateObj = new Date();
    animate( "Instantiated dateObj - empty argument list" );
    /***** 2. Set the month to the month you were born */
    //animate( "Set month to birth month" );
    /***** 3. Set the day to the day of the month you were born */
    //animate( "Set day to birth day" );
    /***** 4. Set the year to the year you were born */
    //animate( "Set year to birth year" );
    /***** 5. Set the day to 32, an illegal value */
    //animate( "Set day to 32" );
    /***** 6. Set the month to 13, an illegal value */
    //animate( "Set month to 13" );
    /***** 7. Assign the value null to dateObj */
    //animate( "Set object reference to null" );
    /***** 8. Attempt to set the month to 1 */
  public DateClient( )
    super( "A Date Object" );
    setSize( 300, 300 );
    setVisible( true );
  public void paint( Graphics g )
    super.paint( g );
    if ( firstTime )
      firstTime = false;
    else
      // display action
      g.drawString( action, 50, 250 );
      // object reference
      int sX = 50, sY = 75;
      int boxL = 75, boxH = 20;
      g.drawRect( sX, sY, boxL, boxH );
      g.drawString( "dateObj", sX, sY - 10 );
      if ( dateObj != null )
        draw( g );
      else
        g.drawString( "null", sX + 15, sY + 15 );
  public void draw( Graphics g )
    int sX = 50, sY = 75;
    int boxL = 75, boxH = 20;
    // arrow
    g.drawLine( sX + boxL, sY + boxH / 2,
                sX + boxL + 25, sY + boxH / 2 );
    g.drawLine( sX + boxL + 25, sY + boxH / 2,
                sX + boxL + 25, sY + boxH * 2 );
    g.drawLine( sX + boxL + 25 - 5, sY + boxH * 2 - 5,
                sX + boxL + 25, sY + boxH * 2 );
    g.drawLine( sX + boxL + 25 + 5, sY + boxH * 2 - 5,
                sX + boxL + 25, sY + boxH * 2 );
    // month
    g.drawString( "month", sX + boxL - 50, sY + 2 * boxH + 15 );
    g.drawRect( sX + boxL, sY + 2 * boxH, boxL, boxH );
    g.drawString( Integer.toString( dateObj.getMonth( ) ),
                   sX + boxL + 5, sY + 2 * boxH + 15 );
    // day
    g.drawString( "day", sX + boxL - 50, sY + 3 * boxH + 15 );
    g.drawRect( sX + boxL, sY + 3 * boxH, boxL, boxH );
    g.drawString( Integer.toString( dateObj.getDay( ) ),
                  sX + boxL + 5, sY + 3 * boxH + 15 );
    // year
    g.drawString( "year", sX + boxL - 50, sY + 4 * boxH + 15 );
    g.drawRect( sX + boxL, sY + 4 * boxH, boxL, boxH );
    g.drawString( Integer.toString( dateObj.getYear( ) ),
                  sX + boxL + 5, sY + 4 * boxH + 15 );
  public void animate( String a )
    action = a;
    repaint( );
    Pause.wait( (double) animationPause );
  public static void main( String [] args )
    DateClient app = new DateClient( );
    app.workWithDates( );
    app.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
}

I noticed that NetBeans was highlighting the very top line of my code and saying "Incorrect Package", so I copied the source files to a different location and just manually compiled them from the command line. I was then able to manually run the program from the command line. Could anyone enlighten me as to what I've done wrong with the "package", and why the program works when I compile and run it manually?

Similar Messages

  • Help! Nothing happens when I try to move files to trash in Bridge

    I have a folder in Bridge CC that contains 17,000 raw files. I want to move most of them to the trash. But when I select files, even a couple, and go FILE > MOVE TO TRASH, nothing happens. I hit DELETE and nothing happens. I try to drag and drop them in the trash. Again, nothing. How can I get rid of these files?

    Please try the Bridge Forum:
    Bridge General Discussion

  • I get a message every time when I execute one jar file

    I have a problem when I try to execute jar files. I use this command: java -jar jarfile.jar. Ok, the jar file is executed, but I receive many messages while the jar file is executed.
    Message:
    The applet is attempting to invoke the java/lang/System.exit() operation - options: Allow or Disallow or Stop Applet, other example: The applet is attempting to invoke the java/Lang/System.getProperty()
    This is one of many other messages that I receive. I'm trying to install the UML plugin for eclipse (omondo - www.ejb3.com)
    thanks
    Edited by: Dixavado on 06/05/2008 16:36

    iPad- Basic troubleshooting
    Locked Out, Forgot Lock or Restrictions Passcode, or Need to Restore Your Device
    1. iTunes 10 for Mac- Update and restore software on iPod, iPhone, or iPad
    2. iOS- Forgotten passcode or device disabled after entering wrong passcode
    3. iPhone, iPad, iPod touch: Wrong passcode results in red disabled screen
    4. iOS- Understanding passcodes
    5. What to Do If You've Forgotten Your iPhone's Passcode
    6. How to Recover Forgotten iPhone Restrictions Passcode | The iPhone and iPad
    7. Restoring iPod touch after forgotten passcode
    8. RecBoot: Easy Way to Put iPhone into Recovery Mode - if all else fails.
    Forgotten Restrictions Passcode Help
    1. How to Recover Forgotten iPhone, iPad Restrictions Passcode
        If this method does not work, then you will need to fully Restore your
        device as New
    Also, see iTunes- Restoring iOS software.

  • Can't open .jar file, nothing happens when I click, MAC OS 10.6.8

    Hello,
    I can't open .jar file, nothing happens when I click on the .jar file.
    I have MAC OS 10.6.8
    The thing it, I have desktop application that I'm building on Netbeans and when I compile and deploy it... it runs from Netbeans folder where I have all the files but copying the .jar on the desktop. It says "The Java JAR file "blablabla.jar" could not be launched check the Console for possible error messages"
    Any idea or solution will be appreciated.
    Thanks in advance
    Charles

    These are Java files.  http://www.java.com/en/ is where you can get the latest Java for your operating system. If your Java files need an older version of Java, there are instructions on the web to downgrade Mac Java, but it is difficult, and poses security issues.

  • I want to uninstall and then reinstall Firefox but I can't uninstall it. Nothing happens when I click remove in program access and defaults and the helper.exe file in the firefox uninstall dir doesn't do anything either.

    I want to uninstall and then reinstall Firefox but I can't uninstall it. Nothing happens when I click remove in program access and defaults and the helper.exe file in the firefox uninstall dir doesn't do anything either.

    "program access and defaults" is not the place to remove programs in Windows. You need to go to the control panel and click on Add and Remove programs. For instructions on how to uninstall Firefox, see [[Uninstalling Firefox]]

  • After Photoshop Elements quit working for the second time in three months, I uninstalled it and now cannot get it to reinstall from the disc. Nothing happens when I insert the disc. All I can do is look at the folders and files and see nothing that tells

    After Photoshop Elements quit working for the second time in three months, I uninstalled it and now cannot get it to reinstall from the disc. Nothing happens when I insert the disc. All I can do is look at the folders and files and see nothing that tells me how to start the installation. Clicking "open with Auto play" gives me irrelevant options, view photos, share, etc. I'm running Windows 8. This program has worked, although buggy, for the past year.

    reinstall by clicking setup on your disk or downloading and installing,
    Downloads available:
    Suites and Programs:  CC | CS6 | CS5.5 | CS5 | CS4 | CS3
    Acrobat:  XI, X | 9,8 | 9 standard
    Premiere Elements:  12 | 11, 10 | 9, 8, 7
    Photoshop Elements:  12 | 11, 10 | 9,8,7
    Lightroom:  5 | 4 | 3
    Captivate:  8 | 7 | 6 | 5
    Contribute:  CS5 | CS4, CS3
    Download and installation help for Adobe links
    Download and installation help for Prodesigntools links are listed on most linked pages.  They are critical; especially steps 1, 2 and 3.  If you click a link that does not have those steps listed, open a second window using the Lightroom 3 link to see those 'Important Instructions'.

  • Trying to synch my ipod and getting message that a file is corrupt and can't communicate.  Trying to restore ipod but nothing happens when I click on restore. What now?

    After following all of the instructions in the help site I get the ipod to the Disc Mode but nothing happens when I click on restore. Help, my wife thinks I'm sabotaging her ipod.

    When you have a compatible Numbers file in icloud (from Numbers on a mac), then when you invoke Numbers on a device, that file immediately shows up in the main window that lists all documents in Numbers.  (Same thing for Pages.)
    I haven't used Numbers, only Pages, so I just made a test.  Created a Numbers file on the mac and "move to" iCloud.  On my iPhone, the file didn't show up - hmm.  Then I remembered I had turned off wifi and in settings have 3G data for documents turned off.  When I turned on wifi and went back to Numbers, the file appeared.
    I suspect you need to import the Excel file into Numbers and then save it as a Numbers file to iCloud, using "move to".
    Using Mountain Lion and latest iOS and Numbers/Pages.

  • Flex PMD view is always empty. Nothing happens when I run Flex PMD/Cut and Paste option

    Hi, "Nothing happens when I run Flex PMD/?Flex cut and paste option ". Please help !! I am using ???Flex Builder 3 + Eclipse 3.3 version. From the adobe forum, I came to know that Flex PMD plugin is tested from the Flex Builder 3 + Eclispe 3.4 version. Does this mean that it wont work on earlier versions of Eclipse. I have installed Flex PMD from the following link which contains version 1.0.0.v200912991712  ??http://opensource.adobe.com/svn/opensource/flexpmd/plugin/trunk/flex-pmd-eclipse-plugin-si te ?? and configured the Flex Plugin(jar files) of version 1.1 & 1.2. Do I need to configure Jar files of version 1.0 as Flex PMD plugin version is 1.0? FYI, there are no white spaces either in my workspace name or project name. Also changed the Java command line to temp directory. But still Flex PMD view is empty. Thanks in Advance

    Hi,
    "Nothing happens when I run Flex PMD/Flex cut and paste option ". Please help !!
    I am using Flex Builder 3 + Eclipse 3.3 version.
    From the adobe forum, I came to know that Flex PMD plugin is tested from the Flex Builder 3 + Eclispe 3.4 version.
    Does this mean that it wont work on earlier versions of Eclipse.
    I have installed Flex PMD from the following link which contains version 1.0.0.v200912991712  http://opensource.adobe.com/svn/opensource/flexpmd/plugin/trunk/flex-pmd-eclipse-plugin-si te
    and configured the Flex Plugin(jar files) of version 1.1 & 1.2.
    Do I need to configure Jar files of version 1.0 as Flex PMD plugin version is 1.0?
    FYI, there are no white spaces either in my workspace name or project name. Also changed the Java command line to temp directory.
    But still Flex PMD view is empty.
    Thanks in Advance

  • Some prolems when trying to create Jar file...

    Hi,
    1st sorry i post this in the wrong box, i posted it in the Jar box but no body replied and I really need to get this done soon...
    I've got a list of *.class and a folder images and Start is the class I want to be the entry point
    I tried:
    1. jar cfm MyApp.jar Manifest.txt *.class images
    In Manifest.txt has a line: Main-Class: Start
    the jar file is created, but when I tried to run (both double click and command line) this gives me an error "Failed to load Main-Class manifest attribute from..."
    2. jar cmf MyApp.jar Manifest.txt *.class images
    this has error while making the jar file, it gives "java.io.FileNotFoundException: MyApp.jar (The system cannot find the file specified)...
    3. I tried the 1st method, then unzip the jar file, edit the manifest.mf file by adding a line Main-Class: Start. Then zip it, rename it to MyApp.jar
    And a weird thing happens... When I place the jar file IN THE SAME FOLDER with other class files, it runs fine. But when I move it to A DIFFERENT FOLDER with other class files, it runs with dimension 0x0, i.e. only the title bar is displayed...
    I've tried those method and none of them work... can some one tell me what I have done wrong?
    Thanks...

    This is the class used to get the ImageIcon for the JLabel
    public class CardGUI extends JPanel {
         private ImageIcon tmp;
         private final int CARDWIDTH = 50; //Card width is 50
         //return the Card GUI
         public ImageIcon getCardGUI (int kind, char suit) {
              //This String is used to locate the file (*.png)
              //of each Card
              //E.g. Card 2 Club will has file "images/cards/2c.png"
              String imgStr = "images/cards/" + kind + suit + ".png";
              tmp = new ImageIcon(imgStr);
              //If the card is not found, return the back of the Card
              if (tmp.getIconWidth()!= CARDWIDTH) {
                   tmp = new ImageIcon("images/cards/back.png");
              return tmp;
    }Then the JLabel used this to set the image, where humanCard1 is an instance of JLabel, and cardLabel is instance of the above class.
    humanCard1.setIcon(cardLabel.getCardGUI(card10.getKind(), card10.getSuit()));
    > new ImageIcon("images/mainbackground.jpg")Wrong. Because there are any more no files in a jar archive. Only file is the jar file itself, and nothing else.
    What do u mean? When I create the jar file, i include the images folder inside the jar file already?
    I've been using the Swing forum and that's how I know the 2 methods above for setting image for JLabel and JPanel... So what should i be searching for in the Swing forum now?

  • Nothing happens when I run FlexPMD

    I am currently running FlexPMD 1.1.0.v201010171930 on Eclipse 3.5.
    When I run the cut & paste check it works fine, but when I run the FlexPMD, it shows up as FlexPMD.running, but the View is always empty.
    Here is what my log looks like:
    Any idea how to fix this?

    Hi,
    "Nothing happens when I run Flex PMD/Flex cut and paste option ". Please help !!
    I am using Flex Builder 3 + Eclipse 3.3 version.
    From the adobe forum, I came to know that Flex PMD plugin is tested from the Flex Builder 3 + Eclispe 3.4 version.
    Does this mean that it wont work on earlier versions of Eclipse.
    I have installed Flex PMD from the following link which contains version 1.0.0.v200912991712  http://opensource.adobe.com/svn/opensource/flexpmd/plugin/trunk/flex-pmd-eclipse-plugin-si te
    and configured the Flex Plugin(jar files) of version 1.1 & 1.2.
    Do I need to configure Jar files of version 1.0 as Flex PMD plugin version is 1.0?
    FYI, there are no white spaces either in my workspace name or project name. Also changed the Java command line to temp directory.
    But still Flex PMD view is empty.
    Thanks in Advance

  • How to execute a jar file which has an applet, without using a html file ?

    I have a jar file which contains a set of class files. iam able to execute the jar file by using this html code
    <html>
    <applet code="file.class" archive="file.jar" width="500" height="300">
    <param name="name" value="value">
    </applet>
    </html>
    I want to know how to execute this class file without using the html tags.
    pls help me out in this.
    Anki

    Hi,
    You can make an executable jar file such that when you double click on that it starts running. Just follow the steps.
    1. Open a notepad and write the following
    Main-Class: XXXXXXXX
    XXXXXXX means Your Main Class name. Don't forget to press Enter after you write your class name.
    2. Save the file as Mani.mf
    3. In the commant prompt ( your directory ) type following lines.
    jar cmf Mani.mf Demo.jar *.*
    4. This will make a jar file which is executable jar file
    Hope this will help you.
    Deepak

  • Hi there, Can you please HELP ME? I created a signature for my email account, but I can not choose it because the option is daded under "none"and nothing happens when you click on it! Thank you, Johan

    Hi there, Can you please HELP ME? I created a signature for my email account, but I can not choose it because the option is daded under "none"and nothing happens when you click on it! Thank you, Johan

    This can be a problem with the file places.sqlite that stores the bookmarks and the history.
    * http://kb.mozillazine.org/Bookmarks_history_and_toolbar_buttons_not_working_-_Firefox

  • Trying to upgrade itunes from 10.4 to 10.6.3 and nothing happens when i click download.  could anyone help please?

    trying to upgrade itunes from 10.4 to 10.6.3 while in itunes app and nothing happens when i click download.  could anyone have a suggestion of a possible solution?  Thx

    trying to upgrade itunes from 10.4 to 10.6.3 while in itunes app and nothing happens when i click download.
    Try updating your iTunes using an iTunesSetup.exe (or iTunes64Setup.exe) installer file downloaded from the Apple website:
    http://www.apple.com/itunes/download/

  • Exception is thrown only while executing the jar file

    java.lang.NoClassDefFoundError: javax/mail/Address Exception is thrown only while executing the jar file. But the program compiles and executes good when executed for command prompt through the class files.
    I used javamail API in my program. Classpath and every others are set to the right one's. Executed fine when used java Random.class. But the problem is only with the jar file.
    Please help me out in this regard. Why the exception is thrown only in jar but not at class level.

    Assuming you're running your program using "java -jar", your jar file needs a Class-Path entry
    in the manifest file that references mail.jar.

  • HT1578 I've done all of this and it won't open. I double click on it, the default program to open it is diskimagemounter and nothing happens when I double click. Any ideas? (Mac OS X Lion 10.7.4)

    I've done all of this and it won't open. I double click on it, the default program to open it is diskimagemounter and nothing happens when I double click. Any ideas? (Mac OS X Lion 10.7.4)

    I would like to create a file that stores my documents and has a password on it so that if I lend my laptop to someone, they can't access my documents. I went into utilities and followed his instructions to do that. I created it on my desktop and its a .dmg extension

Maybe you are looking for

  • Creating hyperlinks in Incopy

    I have created hyperlinks in Incopy and tested them using the hyperlinks panel. The links work. However, when I export to PDF from Incopy, the hyperlinks are not there. I noticed when exporting the PDF from Incopy, there is no option in include hyper

  • URL passing value problems

    <p>Hi</p> <p>I am conditionally displaying an image in a table with a URL link which when used passes the item value from the row to a hidden item in the linked page (page 5).</p> <p>however the value isn't passed and i have no idea why - but aside f

  • Conditionalized text and abutting variables

    The content uses two variables: " institution" and " campus." All text regarding campuses needs to be conditionalized. For the most part, I've had complete success with conditionalizing text that includes variable(s). The problem comes in when there

  • Can´t buy lion in appstore?

    I Can´t buy lion in appstore. Because in appstore on the buy button said Lion already installed. Why? Thanks //M

  • Mi celular termina de recibir el update 4.3.2 y me gustaría saber que modificaciones le han hecho y con que beneficiones (que descuento que los tiene)

    En este caso me gustaría saber sobre las modificaciones del update 4.3.2. En que consisten y con que beneficiones, que descuento que los tiene. En esa línea, seria importante que cuando se pregunta sobre si realizar o no un update, ya en ese cuadro d