Page 2 of 2 FirstFirst 12
Results 21 to 32 of 32
  1. #21
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    Here's what I have as my jarfile value
    That's strange. Do you mean the entry in the shell/open/command leaf?
    The jarfile entry itself just has: Default .. Executable Jar File
    Does that path look good?

  2. #22
    a_programmer is offline Member
    Join Date
    Jun 2011
    Posts
    19
    Rep Power
    0

    Default



    This is what I have. Sorry it's a little small.
    Last edited by a_programmer; 07-15-2011 at 04:00 AM.

  3. #23
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    Is there a javaw.exe file in C:\Program Files\Java\jre6\bin\ folder?

  4. #24
    a_programmer is offline Member
    Join Date
    Jun 2011
    Posts
    19
    Rep Power
    0

    Default

    Yep. I changed the file association to the java.exe file that's in the same folder as well, but that didn't work so I changed it back to javaw.exe

  5. #25
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    Did you get a flash on the screen (the command prompt window quickly opening and closing) when you used the java.exe command vs javaw.exe?

    Try taking the command line to the command prompt window and see if it will execute there ok.
    Replace the %1 with the jarfile filename.

  6. #26
    a_programmer is offline Member
    Join Date
    Jun 2011
    Posts
    19
    Rep Power
    0

    Default

    Yes I do get a flash on the screen.

    Which command do I use? If I type "C:\Program Files\Java\jre6\bin\javaw.exe" -jar "java.jar" %* it will say "Unable to access jarfile java.jar"

    java -jar "java.jar" %* runs fine.
    java -jar "java.jar" runs fine too.

  7. #27
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    If I type "C:\Program Files\Java\jre6\bin\javaw.exe" -jar "java.jar" %*
    it will say "Unable to access jarfile java.jar"
    Did you try it without the "s around the jar filename?
    Also try it with the java.exe command vs javaw.exe
    Can you copy and paste here the console:
    To copy the contents of the command prompt window:
    Click on Icon in upper left corner
    Select Edit
    Select 'Select All' - The selection will show
    Click in upper left again
    Select Edit and click 'Copy'

    Paste here.



    Here is what I get when there jar file does not exist:

    D:\Norms\Norms Tools>D:\Java\jre6_20\bin\java.exe -jar asdf.jar
    Unable to access jarfile asdf.jar
    Last edited by Norm; 07-15-2011 at 04:37 AM.

  8. #28
    a_programmer is offline Member
    Join Date
    Jun 2011
    Posts
    19
    Rep Power
    0

    Default

    Here's what it shows:

    The system cannot find message text for message number 0x2350 in the message fil
    e for Application.

    Copyright (c) 2009 Microsoft Corporation. All rights reserved.

    C:\Users\Brett\Documents\NetBeansProjects\calc\dis t>java -jar calc.java
    Unable to access jarfile calc.java

    C:\Users\Brett\Documents\NetBeansProjects\calc\dis t>"C:\Program Files\Java\jre6\
    bin\javaw.exe" -jar "calc.jar" %*

    C:\Users\Brett\Documents\NetBeansProjects\calc\dis t>java -jar "calc.jar" %*
    Enter infix expression: h
    Error in expression. Invalid character.

    C:\Users\Brett\Documents\NetBeansProjects\calc\dis t>java -jar "calc.jar"
    Enter infix expression: q
    Error in expression. Invalid character.

    C:\Users\Brett\Documents\NetBeansProjects\calc\dis t>java -jar calc.jar
    Enter infix expression: q
    Error in expression. Invalid character.

    C:\Users\Brett\Documents\NetBeansProjects\calc\dis t>"C:\Program Files\Java\jre6\
    bin\javaw.exe" -jar "java.jar" %*

    C:\Users\Brett\Documents\NetBeansProjects\calc\dis t>"C:\Program Files\Java\jre6\
    bin\javaw.exe" -jar "java.jar" %*

    C:\Users\Brett\Documents\NetBeansProjects\calc\dis t>"C:\Program Files\Java\jre6\
    bin\javaw.exe" -jar java.jar %*

    C:\Users\Brett\Documents\NetBeansProjects\calc\dis t>java calc.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: calc/jar
    Caused by: java.lang.ClassNotFoundException: calc.jar
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    Could not find the main class: calc.jar. Program will exit.

    C:\Users\Brett\Documents\NetBeansProjects\calc\dis t>java -jar calc.jar
    Enter infix expression: 1 + x
    Converted expression: 1 x +
    Enter a value for x: 2
    The result is: 3
    Enter a value for x: q
    Not an integer. Exiting.

    C:\Users\Brett\Documents\NetBeansProjects\calc\dis t>
    Oh, for the "C:\Program Files\Java\jre6\bin\javaw.exe" -jar "java.jar" %* a dialog box would pop up saying "Unable to access jarfile java.jar". It didn't show up in the command prompt.
    Last edited by a_programmer; 07-15-2011 at 04:45 AM.

  9. #29
    a_programmer is offline Member
    Join Date
    Jun 2011
    Posts
    19
    Rep Power
    0

    Default

    I searched frantically on Google but still haven't found an answer. But, I found out I can run dialog boxes.

    If I run a dialog box program inside Netbeans with a button that does
    Java Code:
    System.out.println("Hello, world!");
    , the message will print where it normally does in the output box at the bottom.

    If I double click the .jar file, the dialog box will come up. When I press the same button, there's no where for Windows to output the text.

  10. #30
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    java -jar calc.jar
    This one seems to have worked. On the other command lines you were referencing non existent jar files.
    Does the program attempt to read from the console? I don't know what javaw.exe will do in that case.
    Also I don't know what java.exe would do???

    Are using a console for input???

  11. #31
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,306
    Rep Power
    25

    Default

    java -jar calc.jar
    This one seems to have worked. On the other command lines you were referencing non existent jar files.
    Does the program attempt to read from the console? I don't know what javaw.exe will do in that case.
    Also I don't know what java.exe would do???

    Are using a console for input???

  12. #32
    fxRichard is offline Member
    Join Date
    Dec 2008
    Posts
    64
    Rep Power
    0

    Default

    Java in Windows 7 is bit finicky due to the Win 7 32-bit compatibility mode. What happens to most people is they have a 64-bit version of Windows but install a 32-bit version of Java, when doing this it installs Java in the C:\Program Files (x86)\ and when running java from the command line WIndows will not find it by default. I didn't bother reading all of this thread so this may not be your issue but it may help someone.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. One program for both Windows and Linux
    By satimis in forum New To Java
    Replies: 8
    Last Post: 04-12-2010, 09:49 AM
  2. Replies: 3
    Last Post: 08-10-2009, 06:34 AM
  3. Executing java program using windows scheduler
    By kanitha in forum New To Java
    Replies: 0
    Last Post: 03-21-2009, 09:16 AM
  4. Replies: 5
    Last Post: 03-20-2009, 10:04 PM
  5. Replies: 1
    Last Post: 01-16-2009, 10:15 PM

Posting Permissions

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