Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 18 of 18

Thread: Deployment demo "AnotherGrep" runs OK in PC but not on another computer

  1. #1
    Junior Member
    Join Date
    Mar 2014
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Deployment demo "AnotherGrep" runs OK in PC but not on another computer

    I made the demo "AnotherGrep" and it works OK in my PC.
    (netbeans.org/kb/articles/javease-deploy.html")

    But when I zipped and unzipped it (using Winrar) to a laptop, it runs briefly in black command screen.
    The application window does not appear.

    On the laptop I have:


    \AnotherGrep
    AnotherGrep.jar
    \lib
    swing-layout-1.0.4.jar

    Both are Windows 7. The ControlPanel on laptop finds java.exe OK.
    What am I missing?


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Deployment demo "AnotherGrep" runs OK in PC but not on another computer

    Try running the jar file in a command prompt window to see if there are any errors.
    Open a window, change to the directory with the jar file and enter the command:
    java -jar AnotherGrep.jar
    Copy the contents of the window and paste it here.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Mar 2014
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Deployment demo "AnotherGrep" runs OK in PC but not on another computer

    PC Command Prompt
    cd to \dist\AnotherGrep.jar.
    java -jar AnotherGrep.jar
    Application appears OK

    PC Windows Explorer, select dist\AnotherGrep.jar
    Open with Java Platform SE binary; Application appears OK

    Laptop Command Prompt
    cd to \dist\AnotherGrep.jar.
    java -jar AnotherGrep.jar
    Application appears OK.

    Laptop Windows Explorer, select dist\AnotherGrep.jar
    Open with Java Platform SE binary; Command Prompt flashes.

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Deployment demo "AnotherGrep" runs OK in PC but not on another computer

    If the jar file's contents executes OK with a manually issued java command, then the problem could be with the OS when it tries to execute the jar.
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    Mar 2014
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Deployment demo "AnotherGrep" runs OK in PC but not on another computer

    Thanks for your help. This sounds way over my head.
    How does the OS act differently when it opens the same jar when running in 2 different places?
    Both computers have Windows 7 with current updates.
    Do I take this problem to Microsoft?

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Deployment demo "AnotherGrep" runs OK in PC but not on another computer

    When you click on a jar file, the OS needs to find a commandline to use to execute the code.
    When you type in the commandline to execute the jar file, it skips having the OS build the commandline.

    The commandline the OS uses is supposed to be stored in the registry on Windows.

    Do you have other jar files for testing to see if your jar file is the problem.

    Did you move the jar file to a new folder away from development for testing?
    If you don't understand my answer, don't ignore it, ask a question.

  7. #7
    Member
    Join Date
    Feb 2014
    Posts
    180
    Thanks
    0
    Thanked 48 Times in 45 Posts

    Default Re: Deployment demo "AnotherGrep" runs OK in PC but not on another computer

    Have you gone through on your laptop the "Troubleshooting JAR File Associations" section in https://netbeans.org/kb/articles/javase-deploy.html, including the part on specifying the -jar option in the file association? Also try creating the .bat script suggested on the web page to see if double-clicking on the .bat script file works.

  8. #8
    Junior Member
    Join Date
    Mar 2014
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Deployment demo "AnotherGrep" runs OK in PC but not on another computer

    Norm:
    I copied another (simpler) application jar file to my laptop. I do not have a Java IDE on the laptop. I’m using it to represent a “user”.
    But it shows the same pattern as AnotherGrep: a command prompt flashes very briefly.

    What is the commandline entry in the Windows registry? What is the correct format?


    Jashburn:
    The laptop file association for jar files correctly shows Java™ Platform SE Binary (same as on my PC). It works on the PC.

    Some of the procedure steps in the Netbeans link do not match Windows 7 Control Panel, e.g. it does not have “Advanced” mentioned here: “5 In the Details section of the dialog box, click Advanced.”

    Ps. When I made my initial post, it did not allow me to insert a link, so I shortened it. I see you have one. How does that work?

  9. #9
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Deployment demo "AnotherGrep" runs OK in PC but not on another computer

    a command prompt flashes very briefly.
    Slow that down by openning a command prompt window, changing to the folder with the jar file and entering the java -jar command.
    What is the commandline entry in the Windows registry?
    Here's an export of the jar file enty:
    Windows Registry Editor Version 5.00

    [HKEY_CLASSES_ROOT\jarfile]
    @="Executable Jar File"

    [HKEY_CLASSES_ROOT\jarfile\shell]

    [HKEY_CLASSES_ROOT\jarfile\shell\open]

    [HKEY_CLASSES_ROOT\jarfile\shell\open\command]
    @="\"C:\\Program Files\\Java\\jre7_7\\bin\\javaw.exe\" -jar \"%1\" %*"
    If you don't understand my answer, don't ignore it, ask a question.

  10. #10
    Junior Member
    Join Date
    Mar 2014
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Deployment demo "AnotherGrep" runs OK in PC but not on another computer

    Quote Originally Posted by Norm View Post
    Slow that down by openning a command prompt window, changing to the folder with the jar file and entering the java -jar command.
    Not sure what you mean. I've already said it works in Command Prompt. Users should not have to use the Command Prompt!

  11. #11
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Deployment demo "AnotherGrep" runs OK in PC but not on another computer

    it works in Command Prompt.
    If it works in the command prompt then the commandline used by the OS must be causing the problem.
    If you don't understand my answer, don't ignore it, ask a question.

  12. #12
    Junior Member
    Join Date
    Mar 2014
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Deployment demo "AnotherGrep" runs OK in PC but not on another computer

    I exported the [HKEY_CLASSES_ROOT\jarfile\shell\open\command], and they’re identical except for the main folder:
    PC
    @="\"C:\\Program Files\\Java\\jre7\\bin\\javaw.exe\" -jar \"%1\" %*"
    Laptop
    @="\"C:\\Program Files (x86)\\Java\\jre7\\bin\\javaw.exe\" -jar \"%1\" %*"

    And mine are same as yours except for the version.

  13. #13
    Junior Member
    Join Date
    Mar 2014
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Deployment demo "AnotherGrep" runs OK in PC but not on another computer

    Good news!
    When I saw the "jarfile" entry in register I wondered about the folder: Program files (x86).
    I confirmed that Java did reside in that folder for older 32-bit applications.
    I uninstalled Java, then downloaded the 64-bit version file: jre-7u51-windows-x64.exe.
    After installing that, I can open the java jar file and the application appears OK.
    I don't know why the 32-bit version caused a problem, but I'm happy.
    IMO there should be a message when user attempts to install a 32-bit application on a 64-bit machine.

    Thanks Norm, for your help.

  14. #14
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Deployment demo "AnotherGrep" runs OK in PC but not on another computer

    What was different between using the commandline from the registry (this one failed)
    and manually entering the commandline (this one worked)?

    Was the java.exe file that was used with the manually entered commandline different from the one referenced from the registry?
    If you don't understand my answer, don't ignore it, ask a question.

  15. #15
    Junior Member
    Join Date
    Mar 2014
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Deployment demo "AnotherGrep" runs OK in PC but not on another computer

    Quote Originally Posted by Norm View Post
    What was different between using the commandline from the registry (this one failed)
    and manually entering the commandline (this one worked)?
    If I understand your question that relates to the original Java, I provided this above:
    Laptop commandline in register:
    @="\"C:\\Program Files (x86)\\Java\\jre7\\bin\\javaw.exe\" -jar \"%1\" %*"
    Manual entry in Command Prompt:
    java -jar AnotherGrep.jar

    Coming from a Windows background, I'm not really interested in the Command Prompt. Is it really needed to make Java applications?

    Was the java.exe file that was used with the manually entered commandline different from the one referenced from the registry?
    I know of only one Java that existed in Program files (x86), so there would have been only one java.exe and javaw.exe.
    I'm not experienced enough to know if multiple concurrent copies of Java can exist.
    HTH

  16. #16
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Deployment demo "AnotherGrep" runs OK in PC but not on another computer

    there would have been only one java.exe and javaw.exe.
    There may be more than one.
    Do a search for java.exe on the C: drive to see how many versions there are. I have one at:
    C:\Windows\System32\java.exe

    Also look at the PATH to see which folder is first: Windows or /bin
    If you don't understand my answer, don't ignore it, ask a question.

  17. #17
    Junior Member
    Join Date
    Mar 2014
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Deployment demo "AnotherGrep" runs OK in PC but not on another computer

    I don't understand that. If I Start, (search) java.exe, the results are presented in 3 groups:
    Programs (1) java.exe in Windows\System32
    Documents(40)
    File(28)
    Similar results on both PC and laptop. The first entry on laptop (System32) was created yesterday when I downloaded the 64-bit Java.
    I don't understand why the java.exe in \Program Files doesn't appear in the Programs group.

    I'm also disappointed in this search feature.
    (a) I want to find java.exe, not other words that look like it (javaw.exe etc..).
    (b) I would expect to see File results (actual occurrences of java.exe), followed by Documents, where the word is found within a document.
    (c) the search results disappear when I click on properties of an item.

    I did not check the PATH yet.

  18. #18
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,165
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: Deployment demo "AnotherGrep" runs OK in PC but not on another computer

    I can't tell how many locations you found the file: java.exe in. It looks like there could be more than one but I don't understand what you have posted.
    I'm also disappointed in this search feature.
    Does Win8 change what you ask to find in a Search to lots of other files that are close to or related to or whatever instead of doing a simple search for the string: "java.exe" in the filename?
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. I am a new Java user, I can't use "javac" in my computer
    By Anna in forum What's Wrong With My Code?
    Replies: 6
    Last Post: November 22nd, 2013, 06:18 AM
  2. Replies: 2
    Last Post: June 22nd, 2013, 10:30 AM
  3. What does "play computer" hand trace segment of code mean?
    By michael305rodri in forum Java Theory & Questions
    Replies: 1
    Last Post: October 16th, 2012, 10:30 AM
  4. Replies: 3
    Last Post: December 7th, 2011, 02:03 AM
  5. What in pan-fried sea snakes is a "proposal computer"?
    By Blackbird in forum What's Wrong With My Code?
    Replies: 1
    Last Post: July 8th, 2011, 09:22 AM