Results 1 to 12 of 12
  1. #1
    'goke70 is offline Member
    Join Date
    Feb 2012
    Posts
    11
    Rep Power
    0

    Default I'm as green as you can have it and I need your help!

    Does it matter where I save my source file? I can't seems to get to get to it in the command prompt when I try to compile it. Please help. I am working on JDK 7.1 and window 7

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,589
    Rep Power
    23

    Default Re: I'm as green as you can have it and I need your help!

    You should create a folder for your java source.
    If you are using command prompt to compile, you need to learn how to use the cd command to change directories to be in the folder with your source files.

  3. #3
    DarrylBurke's Avatar
    DarrylBurke is offline Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,189
    Rep Power
    19

    Default Re: I'm as green as you can have it and I need your help!

    I am working on JDK 7.1 and window 7
    I suppose you mean Windows 7.

    Shift+Right-click --> Open command window here.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  4. #4
    'goke70 is offline Member
    Join Date
    Feb 2012
    Posts
    11
    Rep Power
    0

    Default Re: I'm as green as you can have it and I need your help!

    Quote Originally Posted by Norm View Post
    You should create a folder for your java source.
    If you are using command prompt to compile, you need to learn how to use the cd command to change directories to be in the folder with your source files.
    I did create my java source, but every time I try to direct it there, I get "could not find or load main class ExampleProgram (which is the file I am trying to compile) what i'm I doing wrong?

  5. #5
    'goke70 is offline Member
    Join Date
    Feb 2012
    Posts
    11
    Rep Power
    0

    Default Re: I'm as green as you can have it and I need your help!

    Yes Darryl, I meant WindowS 7

  6. #6
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,589
    Rep Power
    23

    Default Re: I'm as green as you can have it and I need your help!

    Copy the full contents of the console window that shows what you entered and the response and paste it here.
    Also do a dir command to show the contents of the directory.

    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.

  7. #7
    'goke70 is offline Member
    Join Date
    Feb 2012
    Posts
    11
    Rep Power
    0

    Default Re: I'm as green as you can have it and I need your help!

    02/18/2012 08:41 AM 14,744 native2ascii.exe
    02/18/2012 08:41 AM 14,728 orbd.exe
    02/18/2012 08:41 AM 14,728 pack200.exe
    02/18/2012 08:41 AM 14,736 policytool.exe
    02/18/2012 08:41 AM 14,728 rmic.exe
    02/18/2012 08:41 AM 14,728 rmid.exe
    02/18/2012 08:41 AM 14,736 rmiregistry.exe
    02/18/2012 08:41 AM 14,736 schemagen.exe
    02/18/2012 08:41 AM 14,736 serialver.exe
    02/18/2012 08:41 AM 14,736 servertool.exe
    02/18/2012 08:41 AM 14,736 tnameserv.exe
    02/18/2012 08:41 AM 179,600 unpack200.exe
    02/18/2012 08:41 AM 14,728 wsgen.exe
    02/18/2012 08:41 AM 14,736 wsimport.exe
    02/18/2012 08:41 AM 14,720 xjc.exe
    47 File(s) 2,440,232 bytes
    2 Dir(s) 417,444,106,240 bytes free

    C:\Program Files\Java\jdk1.7.0_03\bin>C:>java Example
    Access is denied.

    C:\Program Files\Java\jdk1.7.0_03\bin>C:>java HelloAppWorld
    Access is denied.

    C:\Program Files\Java\jdk1.7.0_03\bin>C:>java HelloAppWorld
    Access is denied.

    C:\Program Files\Java\jdk1.7.0_03\bin>javac
    Usage: javac <options> <source files>
    where possible options include:
    -g Generate all debugging info
    -g:none Generate no debugging info
    -g:{lines,vars,source} Generate only some debugging info
    -nowarn Generate no warnings
    -verbose Output messages about what the compiler is doing
    -deprecation Output source locations where deprecated APIs are u
    sed
    -classpath <path> Specify where to find user class files and annotati
    on processors
    -cp <path> Specify where to find user class files and annotati
    on processors
    -sourcepath <path> Specify where to find input source files
    -bootclasspath <path> Override location of bootstrap class files
    -extdirs <dirs> Override location of installed extensions
    -endorseddirs <dirs> Override location of endorsed standards path
    -proc:{none,only} Control whether annotation processing and/or compil
    ation is done.
    -processor <class1>[,<class2>,<class3>...] Names of the annotation processors
    to run; bypasses default discovery process
    -processorpath <path> Specify where to find annotation processors
    -d <directory> Specify where to place generated class files
    -s <directory> Specify where to place generated source files
    -implicit:{none,class} Specify whether or not to generate class files for
    implicitly referenced files
    -encoding <encoding> Specify character encoding used by source files
    -source <release> Provide source compatibility with specified release

    -target <release> Generate class files for specific VM version
    -version Version information
    -help Print a synopsis of standard options
    -Akey[=value] Options to pass to annotation processors
    -X Print a synopsis of nonstandard options
    -J<flag> Pass <flag> directly to the runtime system
    -Werror Terminate compilation if warnings occur
    @<filename> Read options and filenames from file


    C:\Program Files\Java\jdk1.7.0_03\bin>C:>java HelloAppWorld
    Access is denied.

    C:\Program Files\Java\jdk1.7.0_03\bin>HelloAppWorld
    'HelloAppWorld' is not recognized as an internal or external command,
    operable program or batch file.

    C:\Program Files\Java\jdk1.7.0_03\bin>java HelloAppWorld
    Error: Could not find or load main class HelloAppWorld

    C:\Program Files\Java\jdk1.7.0_03\bin>java Example
    Error: Could not find or load main class Example

    C:\Program Files\Java\jdk1.7.0_03\bin>java Example
    Error: Could not find or load main class Example

    C:\Program Files\Java\jdk1.7.0_03\bin>java HelloAppWorld
    Error: Could not find or load main class HelloAppWorld

    C:\Program Files\Java\jdk1.7.0_03\bin>java GalToLit
    Error: Could not find or load main class GalToLit

    C:\Program Files\Java\jdk1.7.0_03\bin>GalToLit
    'GalToLit' is not recognized as an internal or external command,
    operable program or batch file.

    C:\Program Files\Java\jdk1.7.0_03\bin>java GalToLit
    Error: Could not find or load main class GalToLit

    C:\Program Files\Java\jdk1.7.0_03\bin>c:

    C:\Program Files\Java\jdk1.7.0_03\bin>cd
    C:\Program Files\Java\jdk1.7.0_03\bin

    C:\Program Files\Java\jdk1.7.0_03\bin>-classpath
    '-classpath' is not recognized as an internal or external command,
    operable program or batch file.

    C:\Program Files\Java\jdk1.7.0_03\bin>javac ExampleProgram.java
    javac: file not found: ExampleProgram.java
    Usage: javac <options> <source files>
    use -help for a list of possible options

    C:\Program Files\Java\jdk1.7.0_03\bin>-help
    '-help' is not recognized as an internal or external command,
    operable program or batch file.

    C:\Program Files\Java\jdk1.7.0_03\bin>help
    For more information on a specific command, type HELP command-name
    ASSOC Displays or modifies file extension associations.
    ATTRIB Displays or changes file attributes.
    BREAK Sets or clears extended CTRL+C checking.
    BCDEDIT Sets properties in boot database to control boot loading.
    CACLS Displays or modifies access control lists (ACLs) of files.
    CALL Calls one batch program from another.
    CD Displays the name of or changes the current directory.
    CHCP Displays or sets the active code page number.
    CHDIR Displays the name of or changes the current directory.
    CHKDSK Checks a disk and displays a status report.
    CHKNTFS Displays or modifies the checking of disk at boot time.
    CLS Clears the screen.
    CMD Starts a new instance of the Windows command interpreter.
    COLOR Sets the default console foreground and background colors.
    COMP Compares the contents of two files or sets of files.
    COMPACT Displays or alters the compression of files on NTFS partitions.
    CONVERT Converts FAT volumes to NTFS. You cannot convert the
    current drive.
    COPY Copies one or more files to another location.
    DATE Displays or sets the date.
    DEL Deletes one or more files.
    DIR Displays a list of files and subdirectories in a directory.
    DISKCOMP Compares the contents of two floppy disks.
    DISKCOPY Copies the contents of one floppy disk to another.
    DISKPART Displays or configures Disk Partition properties.
    DOSKEY Edits command lines, recalls Windows commands, and
    creates macros.
    DRIVERQUERY Displays current device driver status and properties.
    ECHO Displays messages, or turns command echoing on or off.
    ENDLOCAL Ends localization of environment changes in a batch file.
    ERASE Deletes one or more files.
    EXIT Quits the CMD.EXE program (command interpreter).
    FC Compares two files or sets of files, and displays the
    differences between them.
    FIND Searches for a text string in a file or files.
    FINDSTR Searches for strings in files.
    FOR Runs a specified command for each file in a set of files.
    FORMAT Formats a disk for use with Windows.
    FSUTIL Displays or configures the file system properties.
    FTYPE Displays or modifies file types used in file extension
    associations.
    GOTO Directs the Windows command interpreter to a labeled line in
    a batch program.
    GPRESULT Displays Group Policy information for machine or user.
    GRAFTABL Enables Windows to display an extended character set in
    graphics mode.
    HELP Provides Help information for Windows commands.
    ICACLS Display, modify, backup, or restore ACLs for files and
    directories.
    IF Performs conditional processing in batch programs.
    LABEL Creates, changes, or deletes the volume label of a disk.
    MD Creates a directory.
    MKDIR Creates a directory.
    MKLINK Creates Symbolic Links and Hard Links
    MODE Configures a system device.
    MORE Displays output one screen at a time.
    MOVE Moves one or more files from one directory to another
    directory.
    OPENFILES Displays files opened by remote users for a file share.
    PATH Displays or sets a search path for executable files.
    PAUSE Suspends processing of a batch file and displays a message.
    POPD Restores the previous value of the current directory saved by
    PUSHD.
    PRINT Prints a text file.
    PROMPT Changes the Windows command prompt.
    PUSHD Saves the current directory then changes it.
    RD Removes a directory.
    RECOVER Recovers readable information from a bad or defective disk.
    REM Records comments (remarks) in batch files or CONFIG.SYS.
    REN Renames a file or files.
    RENAME Renames a file or files.
    REPLACE Replaces files.
    RMDIR Removes a directory.
    ROBOCOPY Advanced utility to copy files and directory trees
    SET Displays, sets, or removes Windows environment variables.
    SETLOCAL Begins localization of environment changes in a batch file.
    SC Displays or configures services (background processes).
    SCHTASKS Schedules commands and programs to run on a computer.
    SHIFT Shifts the position of replaceable parameters in batch files.
    SHUTDOWN Allows proper local or remote shutdown of machine.
    SORT Sorts input.
    START Starts a separate window to run a specified program or command.
    SUBST Associates a path with a drive letter.
    SYSTEMINFO Displays machine specific properties and configuration.
    TASKLIST Displays all currently running tasks including services.
    TASKKILL Kill or stop a running process or application.
    TIME Displays or sets the system time.
    TITLE Sets the window title for a CMD.EXE session.
    TREE Graphically displays the directory structure of a drive or
    path.
    TYPE Displays the contents of a text file.
    VER Displays the Windows version.
    VERIFY Tells Windows whether to verify that your files are written
    correctly to a disk.
    VOL Displays a disk volume label and serial number.
    XCOPY Copies files and directory trees.
    WMIC Displays WMI information inside interactive command shell.

    For more information on tools see the command-line reference in the online help.


    C:\Program Files\Java\jdk1.7.0_03\bin>classpath
    'classpath' is not recognized as an internal or external command,
    operable program or batch file.

    C:\Program Files\Java\jdk1.7.0_03\bin>Program Files\Java\jdk1.7.0\bin\javac" Myj
    ava.java
    'Program' is not recognized as an internal or external command,
    operable program or batch file.

    C:\Program Files\Java\jdk1.7.0_03\bin>javac"myjava
    'javac"myjava' is not recognized as an internal or external command,
    operable program or batch file.

    C:\Program Files\Java\jdk1.7.0_03\bin>cd C:\

    C:\>Program Files\Java\jdk1.7.0_3\bin
    'Program' is not recognized as an internal or external command,
    operable program or batch file.

    C:\>jdi1.7.0_03\bin
    The system cannot find the path specified.

    C:\>java Example
    Error: Could not find or load main class Example

    C:\>\Program Files\Java\jdk1.7.0_03\Projects\Module1
    '\Program' is not recognized as an internal or external command,
    operable program or batch file.

    C:\>Program Files\Java\jdk1.7.0_03\Projects\Module1
    'Program' is not recognized as an internal or external command,
    operable program or batch file.

    C:\>\Java\jdk1.7.0_03\Projects\Module1
    The system cannot find the path specified.

    C:\>\Program Files\Java\jdk1.7.0_03\Projects\Module1
    '\Program' is not recognized as an internal or external command,
    operable program or batch file.

    C:\>cd Program Files\Java\jdk1.7.0_03\Projects\Module1

    C:\Program Files\Java\jdk1.7.0_03\Projects\Module1>java Example2
    Error: Could not find or load main class Example2

    C:\Program Files\Java\jdk1.7.0_03\Projects\Module1>cd C:\Users\Olagoke Olagbegi\
    Documents\My docs

    C:\Users\Olagoke Olagbegi\Documents\My docs>\>java.Example
    '\' is not recognized as an internal or external command,
    operable program or batch file.

    C:\Users\Olagoke Olagbegi\Documents\My docs>Example
    'Example' is not recognized as an internal or external command,
    operable program or batch file.

    C:\Users\Olagoke Olagbegi\Documents\My docs>java Example
    Error: Could not find or load main class Example

    C:\Users\Olagoke Olagbegi\Documents\My docs>java Example
    Error: Could not find or load main class Example

    C:\Users\Olagoke Olagbegi\Documents\My docs>Example.java

    C:\Users\Olagoke Olagbegi\Documents\My docs>C:\Users\Olagoke Olagbegi\Documents\
    My docs\Java codes\ExampleProgram
    'C:\Users\Olagoke' is not recognized as an internal or external command,
    operable program or batch file.

    C:\Users\Olagoke Olagbegi\Documents\My docs>cd C:\Users\Olagoke Olagbegi\Documen
    ts\My docs\Java codes\ExampleProgram

    C:\Users\Olagoke Olagbegi\Documents\My docs\Java codes\ExampleProgram>
    C:\Users\Olagoke Olagbegi\Documents\My docs\Java codes\ExampleProgram>javec Exam
    pleProgram
    'javec' is not recognized as an internal or external command,
    operable program or batch file.

    C:\Users\Olagoke Olagbegi\Documents\My docs\Java codes\ExampleProgram>java Examp
    leProgram
    Error: Could not find or load main class ExampleProgram

    C:\Users\Olagoke Olagbegi\Documents\My docs\Java codes\ExampleProgram>

  8. #8
    'goke70 is offline Member
    Join Date
    Feb 2012
    Posts
    11
    Rep Power
    0

    Default Re: I'm as green as you can have it and I need your help!

    here is the directory


    C:\Users\Olagoke Olagbegi\Documents\My docs\Java codes\ExampleProgram>dir
    Volume in drive C has no label.
    Volume Serial Number is FEC4-4CFA

    Directory of C:\Users\Olagoke Olagbegi\Documents\My docs\Java codes\ExampleProg
    ram

    02/18/2012 01:27 PM <DIR> .
    02/18/2012 01:27 PM <DIR> ..
    02/18/2012 01:27 PM 157 ExampleProgram.java
    1 File(s) 157 bytes
    2 Dir(s) 415,227,645,952 bytes free

    C:\Users\Olagoke Olagbegi\Documents\My docs\Java codes\ExampleProgram>

  9. #9
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,589
    Rep Power
    23

    Default Re: I'm as green as you can have it and I need your help!

    What was post#7?

    You should not be in any of the folders that are part of the JDK!!!
    You need to create your own folder for your java source files.

    Your console log does not show where you tried to compile the ExampleProgram.java file?

    Take a look at this:
    "Hello World!" for Microsoft Windows (The Java™ Tutorials > Getting Started > The "Hello World!" Application)

  10. #10
    'goke70 is offline Member
    Join Date
    Feb 2012
    Posts
    11
    Rep Power
    0

    Default Re: I'm as green as you can have it and I need your help!

    thanks, the information looks promising, I will give you a feed back after i go through it.

  11. #11
    'goke70 is offline Member
    Join Date
    Feb 2012
    Posts
    11
    Rep Power
    0

    Default Re: I'm as green as you can have it and I need your help!

    Hi Norm, thanks for your help, I went through the link you sent me, but this is what I am coming up with now

    Microsoft Windows [Version 6.1.7600]
    Copyright (c) 2009 Microsoft Corporation. All rights reserved.

    C:\Users\Olagoke Olagbegi>cd C:\Users\Olagoke Olagbegi\Documents\My docs

    C:\Users\Olagoke Olagbegi\Documents\My docs>dir
    Volume in drive C has no label.
    Volume Serial Number is FEC4-4CFA

    Directory of C:\Users\Olagoke Olagbegi\Documents\My docs

    02/18/2012 04:55 PM <DIR> .
    02/18/2012 04:55 PM <DIR> ..
    02/18/2012 04:48 PM 257 Example.java
    01/31/2012 06:19 PM <DIR> Import Export business
    02/18/2012 01:27 PM <DIR> Java codes
    01/08/2012 07:36 AM 41,382 MailInDislcosureRequest.pdf
    02/16/2012 03:11 PM 15,926 Weekly Roster for Security Workers at Jub
    ilee Christian Church.docx
    02/15/2012 11:33 AM 190,107 Weekly Roster for Security Workers at Jub
    ilee Christian Church.pdf
    02/16/2012 03:10 PM 379,044 Weekly Roster for Security Workers at Jub
    ilee Christian Churchrev.pdf
    5 File(s) 626,716 bytes
    4 Dir(s) 415,205,462,016 bytes free

    C:\Users\Olagoke Olagbegi\Documents\My docs>javac Example.java
    'javac' is not recognized as an internal or external command,
    operable program or batch file.

    C:\Users\Olagoke Olagbegi\Documents\My docs>

  12. #12
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,589
    Rep Power
    23

    Default Re: I'm as green as you can have it and I need your help!

    'javac' is not recognized as an internal or external command,
    The OS can not find the javac.exe file. It looks in the folders on the Path to find .exes etc.
    Most people add the path to the folder that the javac.exe file is in to the Path Environment variable.
    There are many posts on how to do that.
    Google or Search here.

Similar Threads

  1. green channel extraction
    By sarah49 in forum Java 2D
    Replies: 1
    Last Post: 01-27-2012, 11:14 AM
  2. 10 green bottles
    By Dave013 in forum New To Java
    Replies: 2
    Last Post: 10-25-2011, 06:41 PM
  3. Change border color from blue to green of JFrame
    By altu57 in forum AWT / Swing
    Replies: 1
    Last Post: 07-10-2010, 04:19 AM
  4. Why do I get this green text?
    By thestubbsinator in forum New To Java
    Replies: 5
    Last Post: 06-07-2010, 12:04 PM
  5. [SOLVED] Expected Range: Red Green Blue
    By AndrewM16921 in forum New To Java
    Replies: 1
    Last Post: 04-03-2009, 07:59 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
  •