Results 1 to 14 of 14
  1. #1
    Alexishy is offline Member
    Join Date
    Jul 2011
    Posts
    6
    Rep Power
    0

    Default Compiles but won't run

    I enrolled in a summer Computer Programming I class, and we were instructed to create, compile, and run the following program. It compiles just fine, but when I go to run it, Window's Installer pops up. I can't do anthing with that except exit out. Why is it not running?


    //************************************************** ************************************************** *****************************
    // Lincoln.java Author: Lewis/Loftus/Cocking
    //
    // Demonstrates the basic structure of a Java application.
    //************************************************** ************************************************** *****************************

    public class Lincoln
    {
    //-------------------------------------------------------------------------------------------------------------------------
    // Prints a presidential quote.
    //-------------------------------------------------------------------------------------------------------------------------
    public static void main (String [] args)
    {
    System.out.println ("A quote by Abraham Lincoln:");

    System.out.println ("Whatever you are, be a good one.");
    }
    }

  2. #2
    Dark's Avatar
    Dark is offline Senior Member
    Join Date
    Apr 2011
    Location
    Camp Lejuene, North Carolina
    Posts
    643
    Rep Power
    4

    Default

    How are you trying to run it? And what do you mean that it brings up the windows installer?
    • Use [code][/code] tags when posting code. That way people don't want to stab their eyes out when trying to help you.
    • +Rep people for helpful posts.

  3. #3
    wookyoo is offline Member
    Join Date
    May 2011
    Posts
    7
    Rep Power
    0

    Default

    The code works fine. I just run it

  4. #4
    Alexishy is offline Member
    Join Date
    Jul 2011
    Posts
    6
    Rep Power
    0

    Default

    I type in java Lincoln into the command prompt and hit enter. Then it asks if I want this program to make changes to the computer, and I click "Yes." Then This pops up: Windows Installer. V 5.0.7600.16385

    msiexec /Option <Required Parameter> [Optional Parameter]

    Install Options
    </package | /i> <Product.msi>
    Installs or configures a product
    /a <Product.msi>
    Administrative install - Installs a product on the network
    /j<u|m> <Product.msi> [/t <Transform List>] [/g <Language ID>]
    Advertises a product - m to all users, u to current user
    </uninstall | /x> <Product.msi | ProductCode>
    Uninstalls the product
    Display Options
    /quiet
    Quiet mode, no user interaction
    /passive
    Unattended mode - progress bar only
    /q[n|b|r|f]
    Sets user interface level
    n - No UI
    b - Basic UI
    r - Reduced UI
    f - Full UI (default)
    /help
    Help information
    Restart Options
    /norestart
    Do not restart after the installation is complete
    /promptrestart
    Prompts the user for restart if necessary
    /forcerestart
    Always restart the computer after installation
    Logging Options
    /l[i|w|e|a|r|u|c|m|o|p|v|x|+|!|*] <LogFile>
    i - Status messages
    w - Nonfatal warnings
    e - All error messages
    a - Start up of actions
    r - Action-specific records
    u - User requests
    c - Initial UI parameters
    m - Out-of-memory or fatal exit information
    o - Out-of-disk-space messages
    p - Terminal properties
    v - Verbose output
    x - Extra debugging information
    + - Append to existing log file
    ! - Flush each line to the log
    * - Log all information, except for v and x options
    /log <LogFile>
    Equivalent of /l* <LogFile>
    Update Options
    /update <Update1.msp>[;Update2.msp]
    Applies update(s)
    /uninstall <PatchCodeGuid>[;Update2.msp] /package <Product.msi | ProductCode>
    Remove update(s) for a product
    Repair Options
    /f[p|e|c|m|s|o|d|a|u|v] <Product.msi | ProductCode>
    Repairs a product
    p - only if file is missing
    o - if file is missing or an older version is installed (default)
    e - if file is missing or an equal or older version is installed
    d - if file is missing or a different version is installed
    c - if file is missing or checksum does not match the calculated value
    a - forces all files to be reinstalled
    u - all required user-specific registry entries (default)
    m - all required computer-specific registry entries (default)
    s - all existing shortcuts (default)
    v - runs from source and recaches local package
    Setting Public Properties
    [PROPERTY=PropertyValue]

    Consult the Windows Installer SDK for additional documentation on the
    command line syntax.

    Copyright Microsoft Corporation. All rights reserved.
    Portions of this software are based in part on the work of the Independent JPEG Group.


    The Only button to press is "Okay."

  5. #5
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    It shouldn't be asking you if you want to allow access, does it do anything if you say no? You are compilig and running with cmd?

  6. #6
    Dark's Avatar
    Dark is offline Senior Member
    Join Date
    Apr 2011
    Location
    Camp Lejuene, North Carolina
    Posts
    643
    Rep Power
    4

    Default

    Have you configured your Java SDK to work in the command prompt?
    • Use [code][/code] tags when posting code. That way people don't want to stab their eyes out when trying to help you.
    • +Rep people for helpful posts.

  7. #7
    Alexishy is offline Member
    Join Date
    Jul 2011
    Posts
    6
    Rep Power
    0

    Default

    It tells me that access is denied if I click "No." Yes, I am using CMD. Dark, by "configure," do you mean "after downloading, change the path?" Because I don't quite understand what you mean.

  8. #8
    Dark's Avatar
    Dark is offline Senior Member
    Join Date
    Apr 2011
    Location
    Camp Lejuene, North Carolina
    Posts
    643
    Rep Power
    4

    Default

    Well yeah, does your CMD have the proper paths set up? I'm not really sure why it would bring up an installer if you had it configured correctly.
    • Use [code][/code] tags when posting code. That way people don't want to stab their eyes out when trying to help you.
    • +Rep people for helpful posts.

  9. #9
    Alexishy is offline Member
    Join Date
    Jul 2011
    Posts
    6
    Rep Power
    0

    Default

    My instructor posted the link to a video tutorial on how to do that. I typed in dir /s java.exe, then marked the c:.......bin., went to environment variables, and edited it into the Path.

  10. #10
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    So your path variable points to the bin folder(which contains the javac file), you generated the .class file correctly? The basics of downloading Jdk is download, install, set path, set classpath of you want, then you should be good to start. Would you mind typing out the step by step process the video took you through?

  11. #11
    Alexishy is offline Member
    Join Date
    Jul 2011
    Posts
    6
    Rep Power
    0

    Default

    At java.sun.com, download the JDK, install it, go to the Command Prompt; type in cd/, to get to c:, then type in "dir /s java.exe." After the computer gives the c:.....bin, then mark it and click on start, then my computer, then system properties, then advanced, then enviroment variables. Go to Path on the bottom and click edit. This video said to go to the end of the text, type ";" and paste what was marked. I have since read another tutorial and moved it to the front of the path, so that it starts: .;c:.....bin; Then click ok three times. The more recent tutorial said to go into command prompt and type: "javac -version" and "java -version" to make sure everything was installed. I did that, too. One more thing: I stored the java file and the program in a CPI file in C:. So, the instructions for compiling and running the program say to change the prompt to C:\CPI. As I said, it does compile. Hope this was enough information.

  12. #12
    Dark's Avatar
    Dark is offline Senior Member
    Join Date
    Apr 2011
    Location
    Camp Lejuene, North Carolina
    Posts
    643
    Rep Power
    4

    Default

    Did javac -version and java -version work?
    • Use [code][/code] tags when posting code. That way people don't want to stab their eyes out when trying to help you.
    • +Rep people for helpful posts.

  13. #13
    sunde887's Avatar
    sunde887 is offline Moderator
    Join Date
    Jan 2011
    Location
    Richmond, Virginia
    Posts
    3,069
    Blog Entries
    3
    Rep Power
    8

    Default

    Whenever I've installed the Jdk I out the bin path in a variable at the top called PATH. Check near the end of this video.

    TheNewBoston – Free Educational Video Tutorials on Computer Programming and More! Java Programming Tutorial – 1 – Installing the JDK

  14. #14
    Alexishy is offline Member
    Join Date
    Jul 2011
    Posts
    6
    Rep Power
    0

    Default

    Yes, Dark, it did work. sunde887, I will check out that video. Thank you both.

Similar Threads

  1. exec problem, compiles but no output?
    By Dark in forum New To Java
    Replies: 21
    Last Post: 04-17-2011, 08:24 AM
  2. compiles but I get errors, need help
    By jjth39347 in forum New To Java
    Replies: 3
    Last Post: 03-06-2011, 08:29 PM
  3. compiles but dosent work...
    By darkflame5019 in forum New To Java
    Replies: 8
    Last Post: 01-01-2011, 07:22 PM
  4. compiles; no display
    By skuzzie in forum New To Java
    Replies: 5
    Last Post: 12-18-2010, 07:57 PM
  5. This program compiles but doesnt run properly!
    By ErikD99 in forum New To Java
    Replies: 5
    Last Post: 12-03-2010, 08:44 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
  •