The Artima Developer Community
Sponsored Link

Java Answers Forum
first timer

3 replies on 1 page. Most recent reply: Nov 13, 2004 9:27 AM by Charles Bell

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 3 replies on 1 page
temi runsaway

Posts: 1
Nickname: runsaway
Registered: Nov, 2004

first timer Posted: Nov 4, 2004 6:03 AM
Reply to this message Reply
Advertisement
hi. i am sure everyone here can solve this problem but i cant seem to be able to. i wrote my first java app -helloworld and when i tried to compile it but i got this message

error: cannot read HelloWorldApp.java
1 error.

can someone please tell me what i am doing wrong and what i can do to correct it
thanx


Shashank D. Jha

Posts: 68
Nickname: shashankd
Registered: May, 2004

Re: first timer Posted: Nov 8, 2004 12:46 AM
Reply to this message Reply
Check the file name

HelloWorldApp.java

If the file name is wrong u get this error.

Karen

Posts: 11
Nickname: karry1412
Registered: Nov, 2004

Re: first timer Posted: Nov 10, 2004 4:08 AM
Reply to this message Reply
Maybe you have it saved as something different. You have to save it as what you called it. For example, if you typed "public class HelloWorld" you have to save it as HelloWorld.java

Charles Bell

Posts: 519
Nickname: charles
Registered: Feb, 2002

Re: first timer Posted: Nov 13, 2004 9:27 AM
Reply to this message Reply
If the file is named "HelloWorldApp.java" then you compile it with the command:

javac HelloWorldApp.java

If the file is named "helloworld.java" then you compile it with the command:

javac helloworld.java


You get the error error: cannot read HelloWorldApp.java when the executable javac cannot find the file named "HelloWorldApp.java"

The compiler looks in the current dirctory to find it.
You can change where the executable looks with the switch
-sourcepath.
You can see compiler options by entering javac at the prompt with no arguments.


That should give a dump of the following:
C:\j2sdk1.4.2_04\projects\Test>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
ed
  -classpath <path>         Specify where to find user class files
  -sourcepath <path>        Specify where to find input source files
  -bootclasspath <path>     Override location of bootstrap class files
  -extdirs <dirs>           Override location of installed extensions
  -d <directory>            Specify where to place generated class 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
  -help                     Print a synopsis of standard options

Flat View: This topic has 3 replies on 1 page
Topic: A good site and a question Previous Topic   Next Topic Topic: problem while parsing script tag from HTMLEditorKit

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use