Wrox Programmer Forums
|
Java Basics General beginning Java language questions that don't fit in one of the more specific forums. Please specify what version.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Java Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 6th, 2005, 09:05 AM
Registered User
 
Join Date: Oct 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using SDK

Hello,

I am a Java beginner. I am running XP and have
downloaded J2SE SDK from the SUN web site.
The SDK is installed directly under my C-drive,
It looks like:
          C:\j2sdk1.4.2_10 with subdirectories
bin (containing java.exe) and lib (containing tools.jar).

I have included C:\j2sdk1.4.2_10\bin in the Path. I have
also created Classpath = C:\j2sdk1.4.2_10\bin.

I am now able to compile text files (.java) to .class files
using the command line (DOS window).

I have a very simple program called Hello and I keep Hello.java
and Hello.class in C:\Workspace.
However, when I try to run the .class file I get:

C:\Workspace>java Hello (return)
Exception in thread "main" java.lang.NoClassDefFoundError: Hello

C:\Workspace>_

I dont think there is anything wrong with the code in 'Hello' because
I have tried tried other demo .class files and I get the same error.

Anyone any idea what I could do about this? (I want to get down
to writing code!).

Thanks, Ernie



 
Old November 6th, 2005, 11:08 PM
Authorized User
 
Join Date: Nov 2005
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Its either because you did not name the file Hello.java , you may mistakenly have used hello.java and java is case sensitive.

 
Old November 6th, 2005, 11:10 PM
Authorized User
 
Join Date: Nov 2005
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

or you have inside your code a class named "hello" instead of "Hello"

 
Old November 10th, 2005, 11:37 AM
Registered User
 
Join Date: Oct 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

No, I have rewritten and recompiled everything
in lower case only (hello) and I still get the
same error message. Any other suggestions?

Ernie.

 
Old November 11th, 2005, 12:29 AM
Registered User
 
Join Date: Oct 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Dear E,
If you post your code it would help. But, from the error, did you have your class "main(String[] blaa blaa" set-up correctly like:

"public class Hello {

public static void main(String[] args) { "

Just check it out, and otherwise post your code so we can help you out.

 
Old December 29th, 2005, 04:53 AM
Registered User
 
Join Date: Dec 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I got it .Thank you




http://www.jvsoft.org
http://www.jvsoft.org






Similar Threads
Thread Thread Starter Forum Replies Last Post
Sdk Development pkhussain Reporting Services 0 January 16th, 2007 04:17 AM
Downloading SDK 1.4 ironchef Java Basics 0 August 31st, 2006 04:51 PM
Please Define SDK eberly General .NET 2 April 10th, 2005 04:49 PM
Direct X SDK krishnabhargav General .NET 0 September 21st, 2004 08:42 AM
Longhorn SDK stu9820 ASP.NET 1.0 and 1.1 Professional 0 May 13th, 2004 12:59 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.