Please any one can help at this problem I have with javac.
I have download the java jdk1.5.0_15 at least 20 times in three (3) machins and it do not compile. Actualy it can not read the file. Javac is installed and is on bin,
when I type javac it brings the manue. But my problem is not reading the file.java.
I have saved the file Hello.java on desktop, do not work. On bin where the javac is and still not work, I have set the path and it still not work any idea what is the wrong. I have used java 1.5.0_0 before three years and I have compile the codes, but after I have rebote the computer from facrory siting I have lost that and this semester I have to use the java for my project. Please if any one can halp.
Thanks

Recommended Answers

All 9 Replies

Please any one can help at this problem I have with javac.
I have download the java jdk1.5.0_15 at least 20 times in three (3) machins and it do not compile. Actualy it can not read the file. Javac is installed and is on bin,
when I type javac it brings the manue. But my problem is not reading the file.java.
I have saved the file Hello.java on desktop, do not work. On bin where the javac is and still not work, I have set the path and it still not work any idea what is the wrong. I have used java 1.5.0_0 before three years and I have compile the codes, but after I have rebote the computer from facrory siting I have lost that and this semester I have to use the java for my project. Please if any one can halp.
Thanks

What are the exact error messages and what exactly are you doing, plus what OS are you using?

Hi and thanks for your reply. As I said it cannot read Hello.java.
It can not read the file.
I have saved as java file and when I open Properties of my file it is saying JAVA File. So the file is on my computer and the path is working because when I type path it gives the path and tha javac is working, but it can not read the file, I am having so bad luck for my project.

I have XP window and HP palvion computer

Hi and thanks for your reply. As I said it cannot read Hello.java.
It can not read the file.
I have saved as java file and when I open Properties of my file it is saying JAVA File. So the file is on my computer and the path is working because when I type path it gives the path and tha javac is working, but it can not read the file, I am having so bad luck for my project.

What's the EXACT error message and what command are you giving it on the command line when you you get that error, and do you ever get any .class files? You describing it in English is fine, but listing the actual Java error message gives more information. I'm looking for something like this:

Exception in thread "main" java.lang.NoClassDefFoundException:haha
Caused by: java.lang.ClassNotFoundException: haha
.
.
.
etc.
.
.

I got this error (intentionally) by typing "java haha" in a directory where there is no "haha.class" file. There are all sorts of errors you can get, following all sorts of commands. Which one are you getting? Are you getting it when you type:

javac *.java

on the command line? If you get any ".class" files, you are at least compiling something. If you get the ".class" files, but then you can't run them successfully, that's a different error.

I again, no class file.
It gives 1 error
cannot read: Wecome.java.
and if i type java Welcome it will give this error Exception in thread "main" java.lang.NoClassDefFoundException:Welcome

cannot read: Wecome.java.
and if i type java Welcome it will give this error Exception in thread "main" java.lang.NoClassDefFoundException:Welcome

Wecome and Welcome is not the same...
For humans, it is understandable, but for Machines, they don't accept it.

If you just mistyped it,

Here is the last option,
If your main class ( public class ) is Welcome, then save it first into Welcome.java

Copy that file into the bin folder where javac.exe exists,
run terminal ( CMD for windows )
Go to the bin folder.
As usual, type javac Welcome.java
If there is an error again, im 100% sure, there is a problem on your code.

And that error should be posted here in order for our experts to advice you immediately.

regards,
sukatoa

i hope u have found the solution to the issue by now... Since the thread still doesnt show a correct reply, here is the possible issue that i think it is, and the solution:

The error "cannot read" comes when, of course, it cannot read the file.. which means, JVM cannot find the file to load, ie the classpath... Generally, if u see the environment variables in My Computer properties, the classpath is set to "." which means the current directory, and here only it will try to search for the java/class files while using javac/java commands...

So, lets say, ur file is in directory A\B\C\xyz.java (and C is the package declared for ur file) compile, u would have to go to the directory C in command prompt and say "javac xyz.java"
Assuming u did not specify another directory while using javac, it will produce the class file in same folder C.
To run the code, u need to specify the fully classified name of the path, ie including the package name. So u will go to directory B in command prompt, and say "java C.xyz"

please note that we have to go to each folder location since they are not specified in the classpath... if u add these folder locations to the classpath, u can directly call java and javac on ur class...

If you cannot cd to the folder where the *.java file is located you can use -classpath option of the javac(java compiler)---see the documentation for javac

how can we can run a already made project in java or vb.net if we hav the foler which is having all files of the project,in any other machine by taking that project floder.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.