Results 1 to 14 of 14
Thread: Compiles but won't run
- 07-04-2011, 08:19 PM #1
Member
- Join Date
- Jul 2011
- Posts
- 6
- Rep Power
- 0
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.");
}
}
- 07-04-2011, 08:31 PM #2
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.
- 07-04-2011, 08:35 PM #3
Member
- Join Date
- May 2011
- Posts
- 7
- Rep Power
- 0
The code works fine. I just run it
- 07-04-2011, 08:36 PM #4
Member
- Join Date
- Jul 2011
- Posts
- 6
- Rep Power
- 0
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."
- 07-04-2011, 08:41 PM #5
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
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?
- 07-04-2011, 08:42 PM #6
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.
- 07-04-2011, 08:45 PM #7
Member
- Join Date
- Jul 2011
- Posts
- 6
- Rep Power
- 0
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.
- 07-04-2011, 08:52 PM #8
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.
- 07-04-2011, 08:55 PM #9
Member
- Join Date
- Jul 2011
- Posts
- 6
- Rep Power
- 0
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.
- 07-04-2011, 09:10 PM #10
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
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?
- 07-04-2011, 09:28 PM #11
Member
- Join Date
- Jul 2011
- Posts
- 6
- Rep Power
- 0
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.
- 07-04-2011, 09:29 PM #12
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.
- 07-04-2011, 09:34 PM #13
- Join Date
- Jan 2011
- Location
- Richmond, Virginia
- Posts
- 3,069
- Blog Entries
- 3
- Rep Power
- 7
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
- 07-04-2011, 09:52 PM #14
Member
- Join Date
- Jul 2011
- Posts
- 6
- Rep Power
- 0
Similar Threads
-
exec problem, compiles but no output?
By Dark in forum New To JavaReplies: 21Last Post: 04-17-2011, 08:24 AM -
compiles but I get errors, need help
By jjth39347 in forum New To JavaReplies: 3Last Post: 03-06-2011, 08:29 PM -
compiles but dosent work...
By darkflame5019 in forum New To JavaReplies: 8Last Post: 01-01-2011, 07:22 PM -
compiles; no display
By skuzzie in forum New To JavaReplies: 5Last Post: 12-18-2010, 07:57 PM -
This program compiles but doesnt run properly!
By ErikD99 in forum New To JavaReplies: 5Last Post: 12-03-2010, 08:44 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks