Error: cannot read: OurFirstProgram.java

Went through all help to no avail. New to Java. Using Windows 2000. Attempting to compile OurFirstProgram.java using MSDOS prompt. Receiving error: cannot read: OurFirstProgram. File saved as .java in C:\j2sdk1.4.1_01\bin\. javac also in same dir.
From MSDOS tried many variations: c:\>j2sdk1.4.1_01\bin\javac -source 1.4 OurFirstProgram.java
Please advise, thanks.

Resolved using simple calculation class:
created seperate directory from j2sdk1.4.1_01 labeled "Fruit" in which Fruit.java file exists.
In MS-DOS from command line, used:
c:\>cd Fruit
C:\Fruit> javac Fruit.java
By identifying the path of where the actual .java file resided, I was able to read and complie the file creating the .class file in the same dir.

Similar Messages

  • Error: cannot read HelloworldApp.java

    Hello
    When I compile the HelloWorldApp.java program. I have this problem:
    I get: error: cannot read HelloworldApp.java. What can I do?
    In addition, How do I use the options? For example:
    javac -g HelloworldApp.java
    I get an error saying that I did not use well the flag g. Is the command bad written?.

    You post has different capitalization of the program name:
    ". . .compile the HelloWorldApp.java program. I have this problem:
    I get: error: cannot read HelloworldApp.java.
    Java is case-sensitive, make sure to capitalize correctly.
    Open a cmd/command window in the directory that contains your .java file and do a "dir helloworldapp.java" command to verify the file exists with the correct name.
    Read the documentation for the javac command to learn how to use the command options.

  • HELP!!- error: cannot read: VidGame.java

    the command prompt displays the following error message
    error: cannot read: VidGame.java
    What do I need to do?

    Just trying to compile the fileI know. Did you type in this?:
    javac VidGame.javaIf so, then you probably arent in the right directory.

  • Error: cannot read: Demonstration.java

    I've just copied the following code:
    public class BasicsDemo {
    public static void main(String[] args) {
    int sum = 0;
    for (int current = 1; current <= 10; current++) {
    sum += current;
    System.out.println("Sum = " + sum);
    I tried compiling it, but I get the error error: cannot read Demonstration.java.
    Could you tell me exactly what is wrong? I've tried everything. Thanks
    Yash

    Sorry, i copied it off the page, but I changed the class name to that.
    I changed it for that particular reason, because it wouldn't work. So i changed the classname. I accidentally pasted what was on the webpage. Here's my one:
    class Demonstration {
    public static void main(String[] args) {
    int sum = 0;
    for (int current = 1; current <= 10; current++) {
    sum = sum + current;
    System.out.println("Sum = " + sum);
    }

  • "Error:cannot read:HelloWorldApp.java" message

    As the caption says,after finding the file I want to compile and start compiling there is the message shown in the subject.Any help would have been valuable...The program is the HelloWorldApp

    The error means that the javac compiler can not read the file you specified. Some common reasons are:
    1. The file is actually named HelloWorldApp.java.txt instead of HelloWorldApp.java To check this, use the command prompt dir command. Do not use a Windows folder view because Windows might hide the .txt. Programs like Notepad will add .txt to the end of the file name unless you put "" around the file name.
    2. You did not specify the right path to the file.

  • Error:  cannot read:  HelloApp.java

    Having written the HelloApp.java file and placed it in the bin with javac.exe, I can't seem to get it to compile. Use of the files from the demos directory doesn't work either, same error. I assume the path is set up okay since javac runs, so can you help me explore another solution?
    Thanks!

    Your file must be named 'HelloApp.java'
    not 'helloApp.java' or 'HELLOapp.java'
    There must be a line in it like
    public class HelloApp ... {
    not
    public class helloApp ... {                                                                                                                                                                                                                                                                                                                                                       

  • Error: cannot read: test.java

    Dear Guys,
    How come I get an error msg like that?
    My autoexec.bat is
    PATH C:\JDK131\BIN
    SET CLASSPATH=.;C:\JDK131\BIN;C:\JDK131\CODE
    Note:
    1. I put my Java codes in C:\JDK131\CODE
    2. I compile the Java code (test.java) in C:\JDK131\BIN
    3. I am using Win98
    Another question:
    1. Is the autoexec.bat case sensitive? which means JDK131 is not equal jdk131?
    Note:
    1. If I put my code in C:\JDK131\BIN, then I can compile it successfully? why?
    Thanks,
    Daniel

    Still having trouble, i don't know if autoexec. its case sensative. What are you writing in to your comand shell ?. Maybe you should get a text editor like TextPad ( http://TextPad.com ) its free. You can compile from inside textpad and run from inside textpad, its not as big and slow as a IDE. And because its only a text editor it won't write the code for you (so you need to learn it) and when textpad is set up right (which is easy) you can compile from any folder you like.
    i think its works when you put your files in the BIN directory because the javac comand is also in the BIN directory, so it sounds like there is still something not right with your classpath. (i use win2000 so i don't have an autoexec.bat file)
    try putting this in your autoexec.bat file
    PATH C:\jdk1.3\bin
    SET CLASSPATH=.;C:\jdk13~1.1\lib\tools.jar;C:\jdk131\code
    Sorry i can't be more help
    but try that new classpath and tell me what happends
    Ant

  • Error: cannot read: *.java

    I'm having difficulty pointing javac.exe to my .java files. My console looks similar to this...
    C:\Sun\AppServer\jdk\bin>javac Example.java
    error: cannot read: Example.java
    1 error
    How can I get javac to see my file? Any help is greatly appreciated.

    Hi,
    First of all please copy your jdk1.5 source file in the root directory of C: drive. If it is in C:\MyFiles\YourFiles\jdk1.5 then change it to C:\jdk1.5. It is more scientific ( or I think so..) to have jdk in your root file.
    If you are using WindowsXP, and having these problems, then please take the following steps:
    1. Go to Control Panel
    2. Click System
    3. Now click Advanced tab.
    4. On the bottom left, there is a button called Environment Variables. Please click it.
    5. Now there are two text fields. Select -- "Path" from the System Variables text field.
    6. Now select edit. On the right side where the windows path ends, put a comma and type C:/jdk1.5/bin ( Please type full extension of your jdk exactly as it is saved in C: drive.
    It may look like this:
    ....Root%\System32\Wbem;C:\jdk1.5.0_06\bin
    7. Now Click all OKs
    8. Now open cmd prompt and compile ur program from its directory.
    9. Now Thank God and be happy!!!!
    Regards,
    Mustufa Shakir Baldiwala

  • Compilation error - cannot read filename

    Hello,
    I am just a starter in Java. I have installed the standard Development kit j2sdk1.4.1_01 on a Windows NT machine. The installation went well.
    When I tried compiling my first file HelloWorldApp.java which is in a directory java, it gave the error 'cannot read: HelloWorldApp.java',
    I have set the path command correctly and typed the following command:
    C:>Java>javac HelloWorldApp.java on the command prompt.
    It is giving same error for other files also, can anyone tell me what is the problem?
    Thanks,
    Sunil

    The error comes from the javac compiler when it can not find the file that you specified. In your case, it is saying that it can not find a file named HelloWorldApp.java in the c:\java directory.
    It is common for this error to be caused by the editor you used to create the file, if the editor is like Notepad. Notepad will append .txt to the file name. If you use the dir command from c:\java you should see HelloWorldApp.java, not HelloWorldApp.java.txt. If that is the problem, a quick work around is to put double quotes around the file name when you save it to keep Notepad from adding .txt.
    http://java.sun.com/docs/books/tutorial/getStarted/cupojava/win32.html

  • Javac "error: cannot read ..." windows 2000

    I have installed jdk1.4.1 on my ibm with windows 2000. Whenever I try to compile a program, I get the message "error: cannot read: filename.java 1 error" Please let me know where I am making a mistake. Thank you.

    No, you place the "" around the name when you save it. This prevents the .txt from being added to the name. This won't allow it to be compiled. I "solved" the problem another way by saving it with All Files and I type in filename.java. This works fine, but I do wonder why the .txt is added on my Windows 2000 machine, but not my Windows XP machine.

  • Error: cannot read: C:\Documents; and Settings\JR\Desktop\logrand.java

    Thats the problem.
    Bug started happening all the sudden.
    Double click a java file on the desktop that just two second before was built fine. Go to build it and it says that.
    "error: cannot read: C:\Documents; and Settings\JR\Desktop\logrand.java"
    Now note this is a file in the IDE.
    copy/paste/change file name/brand new file/turn off the computer. Everything on the desktop path says that same error message. Then i noted the semicolon in the middle of the path after documents. The compilier has misspelled the path name. Its open the file in the IDE but somehow the build step gets a path with a semicolon in the middle.
    What do i do?

    dont bother.
    it felt like some sort of corruption so i just reinstalled netbeans and that did the trick.
    I was still using 3.5 any way =)

  • "Error:cannot read: src/Ch1Servlet.java"

    I'm trying to compile a class from the command line and when I do so it gives me the following error:
    "Error:cannot read: src/Ch1Servlet.java".
    Can somebody help me to solve this problem.
    Thanks.

    double post
    http://forum.java.sun.com/thread.jspa?threadID=702918

  • Error: cannot read: {My applet name}

    I write the little program in Notepad and save it in C:\JDK1.3.1_02\bin\. Then I go to Command Prompt and
    type: javac {My applet name}. I then get the error: ERROR: CANNOT READ: {MY APPLET NAME}

    This {My applet name} have the same name of your class? The Java don't compiles if your class name has different of the files name . Another Error that can be possible that you files it's read only in their properties. What you can make is enable your file for full access.

  • Compiler Error: cannot read

    starting java. using MSDOS window on windows 98.
    have autoexec path sorted out so compiler is invoked OK.
    submit HelloWorld.java to it gets
    cannot read:HelloWorld.java
    verbose compiler option only tells me low long it spent.
    How do I find out what is wrong. SUN site search produced no response to "compiler error".
    This is a show stopper. Please help.
    Mike.

    If you search the forums for "cannot read" you'll find some answers.
    Basically, the cannot read error from the javac compiler means the compiler can't find the file. The argument to the javac command must be a file name or path name to the file(s). It appears that the command you entered was "javac HelloWorld.java" so a file name HelloWorld.java must exist in the directory you were in when you entered the command.
    Use the DOS DIR command to make sure the file exists. If you used a text editor like Notepad to create your source file, Notepad may have saved the file as HelloWorld.java.txt so javac wouldn't find it.

  • JDK7 INSTALLATION FAILS WITH ERROR CANNOT FIND REQUIRED JAVA RUNTIME ENVIRONMENT

    Hi
    I am trying to install jdk7 on windows7 through command line with command java_ee_sdk-6u4-jdk7-windows-x64 -j "C:\Program Files\Java\jre7\bin". But it fails with error cannot find required java runtime environment in C:\Program Files\Java\jre7\bin. I have set the java_home and path environment variables to above path. Also I tried instaling through installer but it gave same error with null in path. Can anyone help?

    Hi
    I am trying to install jdk7 on windows7 through command line with command java_ee_sdk-6u4-jdk7-windows-x64 -j "C:\Program Files\Java\jre7\bin". But it fails with error cannot find required java runtime environment in C:\Program Files\Java\jre7\bin. I have set the java_home and path environment variables to above path. Also I tried instaling through installer but it gave same error with null in path. Can anyone help?

Maybe you are looking for

  • Downloads to a computer or device not previously associated with an Apple ID?

    Apple sends me emails telling me that my Apple ID was used to download an app from the App Store to a computer or device that had not previously been associated with my Apple ID.  Apple advises me reset my password. I have reset my password about 20

  • File Information in PDF Output

    Does anyone know why InDesign is putting the file info outside of the crop marks? Screen shot below: We have an outside slug area of 24 pts defined and at first I thought it was going to that but it is actually about 4pts IN from that. We've also don

  • Internal Software Error in MIG

    Running Windows XP SP 3 Labview 8.2 Error:  Error -229665 occurred at DAQmx Create Channel (DO-Digital Output).vi:1 Internal Software Error occurred in MIG software. Please contact National Instruments Support. No new devices installed.  When opening

  • Surname and password rejection when setting up ema...

    Really like my Galaxy S2 however went onto Samsung Kies and upgraded the phone and now I cannot reset my email connection with BT, keeps coming back with Incorrect Username and Password popup. Really need some help on this one as this is a business p

  • Problem while activating sender business system

    hi, when iam trying to activate my sender business system,iam getting the following error " Check Result for Object ECC6_BS   SAP system ID EC6 and client 800 already exist in service | ec6_bs_sap". what would be teh problem ? Thanks . Mano