Two Laptop Bag*
The moose likes Beginning Java and the fly likes Many Problems Compiling HelloWorld.java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Many Problems Compiling HelloWorld.java" Watch "Many Problems Compiling HelloWorld.java" New topic
Author

Many Problems Compiling HelloWorld.java

Nige'l Origina'l
Greenhorn

Joined: May 20, 2006
Posts: 7
Hi Guys,

I stumbled upon this site searching for help to this error:

error: cannot read: HelloWorldApp.java

However you all didn't answer my question on that thread at all because for the 5 to 7 hours of time I have been searching and gotten through the installing part....
after changing my dir <cd> to C:\Program Files\Java>
Dos acts if it is trying to actually compile the program but I get the ERROR ABOVE ^^^

Now, I'm still getting this error after trying to run this command:

jdk1.5.0_06\bin\javac HelloWorldApp.java

now I do get the correct response when running java -version

However if I try to directly input javac HelloWorld.java then I get 'javac' is not reconized internally nor externally

Since I have the dir changed, I just want the command to compile the program. I dropped the HelloWorldApp.java over the javac and it compiled the Class file in the directory itself, but I don't want this....

I want it to work properly...

I'm a software engineer major and I'm in IT360 (OOP) and my first assignment is Due Monday but I haven't been able to finish the book of Learning Java in a Weekend due to this stupid response I'm getting...

Can somenoe Please help me?
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Welcome to JavaRanch!

"javac" being unrecognized sounds like your PATH variable isn't set. See Update the PATH variable from these installation instructions for Windows.

As for the "cannot read" error, where exactly is the .java file saved? Is it actually under c:\program files\java? Whatever directory it's in is what you should change your directory to. If you're in the correct directory and it's still giving you this error, make sure that you've saved the file as plain (not rich) text.

For a step-by-step guide, see this Hello World tutorial (for Windows.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Nige'l Origina'l
Greenhorn

Joined: May 20, 2006
Posts: 7
Hi Marc and thank you for the welcome..

and I have ran through those steps in their entirey...

My path is set as so:

C:\Program Files\jdk1.5.0_06\bin

This is the setup they have for XP users..

and yes I had to place the file in the actual bin because it wasn't reading it from Other solutions I have read...

I don't know where to go ....

What's the next step?
Nige'l Origina'l
Greenhorn

Joined: May 20, 2006
Posts: 7
Okay...now I'm getting this Error

Exception in thread "main" Java.lang.NoClassDefFoundError: HelloWorldApp.java

Sounds like there is a problem in the main command line...
But what? I put exactly what the HelloWorld said to put..lol...

This is getting frustrating...

as a matter of fact...here's my program

/*
*
* This is a very simple Java program that prints a message
*/
public class HelloWorld {
public static void main(String args[]) {
//print a message to standard output
System.out.println("Hello, World");
}
}
[ May 20, 2006: Message edited by: Nige'l Origina'l ]
Nige'l Origina'l
Greenhorn

Joined: May 20, 2006
Posts: 7
okay according to Learn Java in a Weekend...

Once I input javac HelloWorldApp.java (HelloWorld.java) and press enter

I should get no response...and that's a good thing...I shall proceed now..

I have gotten the problem solved..I assume that rebooting the computer after setting the paths Earlier today needed to be done...BOIYOING!!!..lol

thanks for your help and since I'm a novice..lol

I SHALL RETURN..buwhahahaha
Nige'l Origina'l
Greenhorn

Joined: May 20, 2006
Posts: 7
lol

I'm back...back to the post before the last....I'm getting the error in the "main" Exception in thread "main" Java.lang.NoClassDefFoundError: HelloWorldApp.java

This is after I type :java HelloWorld.java

I typed it as it was suppose to be typed and can't see the error in the text could someone point it out for me
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Originally posted by Nige'l Origina'l:
...I'm getting the error in the "main" Exception in thread "main" Java.lang.NoClassDefFoundError: HelloWorldApp.java

This is after I type :java HelloWorld.java
...

When you run java, do not include the .java extension. Just type:

java HelloWorld
Nige'l Origina'l
Greenhorn

Joined: May 20, 2006
Posts: 7
Well I did that as well and I still get the Error Marc....lol

I did finally catch that one...good eye..but what's next
Nige'l Origina'l
Greenhorn

Joined: May 20, 2006
Posts: 7
Sorry...GOT IT...lol

I know I'm over ANXIOUS..I need to learn this and the main part is Im rushing

the problem is...(Which I should have remembered from last course of Object Oriented Programming...)

It (java) has a memory ...so until you close the Browser....lol..it will remember everything you typed...

For everyone having my problem..please Close the Browser and start over each time...

When I did that...it obviously remembered the java HelloWorld.java and when I closed it....I retyped it java HelloWorld and it said ....Hello, World

Thanks...I can now move on to the next step in this book..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Many Problems Compiling HelloWorld.java