Link to home
Start Free TrialLog in
Avatar of JohnSrinivassan
JohnSrinivassan

asked on

UNABLE TO COMPILE JAVA PROGRAMME FILES

Sir,
I am new to Java programming language.  I have downloaded the J2sdk software from the Sun Micorsystems site namely jdk-6u2-windows-i586-p and jdk-6u2-windows-i586-p-iftw files.   I have also installed them in my PC, which is WINDOWS ME edition.  

I have also set the variables in the Path, as C:\WINDOWS;C:\WINDOWS\COMMAND;C:\j2sdk1.4.2_02\BIN, I have also tried the version as C:\WINDOWS;C:\WINDOWS\COMMAND;C:\j2sdk1.4.2_06\BIN, but still I am not able to compile and create one single Jave file in the MS DOS promt screen.  

Everytime I try to complie my Hello.java file like this
C:\seenujava>javac Hello.java
I get the following message.
Bad command or file name

I need your support to get me out of this bottle neck.   Thanks.
Avatar of DefreeComan
DefreeComan

Have you checked to be sure javac.exe does in fact exist in C:\j2sdk1.4.2_02\BIN ?
Have you restarted the computer (which will do the actual update of the PATH) ?
Have you checked that the program works when you type in its full path at the prompt ?
It is strange that you install java 6 ( jdk-6u2-windows-i586-p) but set your path to jdk1.4.2\bin.

From my experience, Window 98 didnt support java 5, so it is possible that Windows ME doesnt support java 6 as well.

Try remove all jdk installed and reinstall only jdk 1.4.2.

:) Hope this help
A correction on Java version for Win9x systems: version 5 works perfectly.

I agree with removing all versions through Add/Remove Programs, reboot and delete the folder C:\Program Files\Java.

Reinstall ONLY version 5 update 12 from here:

http://java.sun.com/javase/downloads/index_jdk5.jsp

Good luck.

Zee
Avatar of JohnSrinivassan

ASKER

Thanks to everybody for the guidance given to me.
Mr. Blue Zee,

I have now unistalled the java programes from my system, rebooted and deteted the Java folder, as per your suggestion.  Now please advice me clearly that of which version of the software should I download from the URL you provided.  I see a list of softwares on this URL list, when I visited the site.
Please see the list and advice accordingly.

JDK 5.0 Update 12 with NetBeans IDE 5.5.1
This distribution of the Java SE Development Kit (JDK) includes NetBeans IDE, which is a powerful integrated development environment for developing applications on the Java platform.


JDK 5.0 Update 9 with Java EE
Java EE provides web services, component model, management, and communications APIs that make it the industry standard for implementing enterprise-class service-oriented architecture (SOA) and Web 2.0 applications.

JDK 5.0 Update 12
The Java SE Development Kit (JDK) includes:
the Java Runtime Environment (JRE)
command-line development tools, such as compilers and debuggers, that are necessary or useful for developing applets and applications

Java Runtime Environment (JRE) 5.0 Update 12
The J2SE Runtime Environment (JRE) allows end-users to run Java applications.

J2SE 5.0 JDK Source Code
JDK 5.0 source code is available for those interested in exploring the details of the JDK. This includes schools, universities, companies, and individuals who want to examine the source code for personal interest or research & development. The licensing does not impose restrictions upon those who wish to work on independent open-source projects.

Please advice at the earliest possible, as after seeing your guiance only, I will start downloading the appropriate file.

Hello Mr. doraemon-nolife:
Thanks for your suggestions/guidance, as well.  I will try Mr.. Blue Zee, route.  

Also, please give me the URL for the version jdk 1.4.2. and give me the precise name of the file, I should download.  Awaiting for your reply.  Thanks.

I would say JDK 5.0 Update 12.

If you read the descriptions that should be clear for you and help you decide what you want/need.

Basic setup for a standard user is the JRE only.

Zee
Mr. Blue Zee,
Once when you email me the download file name, also please give me how exactly I should set the path variable.  Thanks.
To download:

Click the "download" button on the right of JDK 5.0 Update 12.

These may be useful:

Installation Notes JDK 5.0 Microsoft Windows (32-bit)
http://java.sun.com/j2se/1.5.0/install-windows.html

Please read paragraph 5: Update the PATH variable (Optional).

Other useful reading:

README Java" 2 Platform Standard Edition Development Kit 5.0
http://java.sun.com/j2se/1.5.0/README.html

Documentation Java" 2 Platform Standard Edition Development Kit 5.0 Update 12
http://java.sun.com/j2se/1.5.0/ReleaseNotes.html

Good luck.

Zee
Your path will be:

"C:\PROGRAM FILES\JAVA\JDK1.5.0_12\BIN"

And from the installation  instructions:

Microsoft Windows ME - To set the PATH permanently:

    From the start menu, choose programs, accessories, system tools, and system information. This brings up a window titled "Microsoft Help and Support". From here, choose the tools menu, then select the system configuration utility. Click the environment tab, select PATH and press the edit button. Now add the JDK to your path as described in step b above. After you've added the location of the JDK to your PATH, save the changes and reboot your machine when prompted.

Cheers,

Zee
Good Morning Mr. Blue Zee,

Now I have typed the path like this as it appears in the path:
C:\WINDOWS;C:\PROGRAM FILES\JAVA\JDK1.5.0_12\BIN

Then in the MS DOS WINDOW, I have type the following commands and the output is as follows:
C:\>c:\autoexec.bat

C:\>SET COMSPEC=C:\WINDOWS\COMMAND.COM

C:\>SET windir=C:\WINDOWS

C:\>SET winbootdir=C:\WINDOWS

C:\>SET PATH=C:\WINDOWS;"C:\PROGRAM FILES\JAVA\JDK1.5.0_12\BIN"

C:\>SET PROMPT=$p$g

C:\>SET TEMP=C:\WINDOWS\TEMP

C:\>SET TMP=C:\WINDOWS\TEMP

C:\>path
PATH=C:\WINDOWS;C:\PROGRA~1\JAVA\JDK15~1.0_1\BIN

C:\>cd\seenujava

C:\seenujava>dir

 Volume in drive C has no label
 Volume Serial Number is 2639-1809
 Directory of C:\seenujava

.              <DIR>        24/07/07  22:24 .
..             <DIR>        24/07/07  22:24 ..
HELLO~1  JAV           271  28/07/07  21:22 Hello.java
SEENU~1  JAV           271  28/07/07  21:49 seenu.java
EXAMPL~1 JAV           284  28/07/07  21:14 Example.java
JANANI~1 TXT           278  30/07/07  22:15 janani.java.txt
SEENUJ~1 TXT           271  28/07/07  21:49 seenu.java.txt
HELLOW~2 JAV           278  30/07/07  22:18 HelloWorldApp.java
HELLOW~1 TXT           278  30/07/07  22:18 HelloWorldApp.txt
         7 file(s)          1,931 bytes
         2 dir(s)        5,025.95 MB free

C:\seenujava>
After typing this command
C:\seenujava>javac Example.java  
Nothing happens and this appears again.
C:\seenujava>
After typing a different file to compile
C:\seenujava>javac Hello.java
Nothing happens and this appears again.
C:\seenujava>
C:\seenujava>DIR

 Volume in drive C has no label
 Volume Serial Number is 2639-1809
 Directory of C:\seenujava

.              <DIR>        24/07/07  22:24 .
..             <DIR>        24/07/07  22:24 ..
HELLO~1  JAV           271  28/07/07  21:22 Hello.java
SEENU~1  JAV           271  28/07/07  21:49 seenu.java
EXAMPL~1 CLA           443  03/08/07  10:01 Example.class
EXAMPL~1 JAV           284  28/07/07  21:14 Example.java
JANANI~1 TXT           278  30/07/07  22:15 janani.java.txt
SEENUJ~1 TXT           271  28/07/07  21:49 seenu.java.txt
HELLOW~2 JAV           278  30/07/07  22:18 HelloWorldApp.java
HELLOW~1 TXT           278  30/07/07  22:18 HelloWorldApp.txt
HELLOW~1 CLA           424  03/08/07  10:06 HelloWorldApp.class
         9 file(s)          2,798 bytes
         2 dir(s)        4,974.25 MB free

C:\seenujava>java Example.java
Exception in thread "main" java.lang.NoClassDefFoundError: Example/java

C:\seenujava>javac Hello.java

C:\seenujava>java Example.class
Exception in thread "main" java.lang.NoClassDefFoundError: Example/class

For the first time, I have seen one class file being created, Thanks for that, but I am unable to see the complete output of the first compiled program.

Please give your input.   Thanks.



Mr. Blue Zee,
I have tried to se the output on another class file created by the compiler, but could not see the output.  Please see the following error message.

C:\seenujava>dir

 Volume in drive C has no label
 Volume Serial Number is 2639-1809
 Directory of C:\seenujava

.              <DIR>        24/07/07  22:24 .
..             <DIR>        24/07/07  22:24 ..
HELLO~1  JAV           271  28/07/07  21:22 Hello.java
SEENU~1  JAV           271  28/07/07  21:49 seenu.java
EXAMPL~1 CLA           443  03/08/07  10:01 Example.class
EXAMPL~1 JAV           284  28/07/07  21:14 Example.java
JANANI~1 TXT           278  30/07/07  22:15 janani.java.txt
SEENUJ~1 TXT           271  28/07/07  21:49 seenu.java.txt
HELLOW~2 JAV           278  30/07/07  22:18 HelloWorldApp.java
HELLOW~1 TXT           278  30/07/07  22:18 HelloWorldApp.txt
HELLOW~1 CLA           424  03/08/07  10:13 HelloWorldApp.class
         9 file(s)          2,798 bytes
         2 dir(s)        4,978.36 MB free

C:\seenujava>java HelloWorldApp.java
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldApp/java

C:\seenujava>
First, please skip the Mr., Zee will be fine...

That's a Java issue and I cannot help you there (not a Java Expert).

I just wanted to make sure the JDK was correctly installed in WinME (that's where I can help you).

Now that I believe it is, maybe a Java expert can see your post and help you out.

Best of luck.

Zee
ASKER CERTIFIED SOLUTION
Avatar of blue_zee
blue_zee
Flag of Portugal image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Zee,

This is how exactly the path appears on the path varible bar.

C:\WINDOWS;C:\PROGRAM FILES\JAVA\JDK1.5.0_12\BIN  - Is it correct?  Please advice.
Hello,

Is there any expert availble in Java Programming to help me to see the 'first' output of the
'first' time compiled class file.  Please help me to come out of this bottle neck.  Thanks.

C:\seenujava>dir

 Volume in drive C has no label
 Volume Serial Number is 2639-1809
 Directory of C:\seenujava

.              <DIR>        24/07/07  22:24 .
..             <DIR>        24/07/07  22:24 ..
HELLO~1  JAV           271  28/07/07  21:22 Hello.java
SEENU~1  JAV           271  28/07/07  21:49 seenu.java
EXAMPL~1 CLA           443  03/08/07  10:01 Example.class
EXAMPL~1 JAV           284  28/07/07  21:14 Example.java
JANANI~1 TXT           278  30/07/07  22:15 janani.java.txt
SEENUJ~1 TXT           271  28/07/07  21:49 seenu.java.txt
HELLOW~2 JAV           278  30/07/07  22:18 HelloWorldApp.java
HELLOW~1 TXT           278  30/07/07  22:18 HelloWorldApp.txt
HELLOW~1 CLA           424  03/08/07  10:13 HelloWorldApp.class
         9 file(s)          2,798 bytes
         2 dir(s)        5,018.73 MB free

C:\seenujava>java Example.java
Exception in thread "main" java.lang.NoClassDefFoundError: Example/java

C:\seenujava>java HelloWorldApp.java
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldApp/java

C:\seenujava>
Hello Zee and others,

I have now done it!!!

C:\seenujava>java Example
This is Seenu's first Java Program.

C:\seenujava>java HelloWorldApp
Hello World!

Thanks for the support given to me, at this stage.  If I am stuck again at any stage, then I will again email you all.  See you !!
Yes, on your question regarding on the path.

But this doesn't make sense to me:

C:\>path
PATH=C:\WINDOWS;C:\PROGRA~1\JAVA\JDK15~1.0_1\BIN

Hopefully you will soon receive some extra help on Java.

Good luck.

Zee
Zee,
My Special thanks to you for the quick support and guidance given to me.
Posted without refreshing, didn't see your last post...

Yupppiiiiieeeeeee....??
:))

Well done.

Zee
You are a recent member, and probably need this info:

What are my choices?
You have five choices when it comes to closing your open questions
https://www.experts-exchange.com/help.jsp#hi67

Cheers,

Zee
The BYTE  value for 42 in binary is 00101010 - Can someone please explain this logic, as I could not understand clearly.
JohnSrinivassan,

You should start a new question.

This one is closed and no one will be able to see it.

Zee