473,396 Members | 1,895 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Need help with SDK

Hello

I've downloaded the Java SDK 1.4.0 from Sun's website in the hope to
learning Java, however when I compile my *.java files this (at most times)
works fine, however when I run the *.class file using java.exe I get this
error message.

D:\jdk1.3\bin>java FirstLine.class

Exception in thread "main" java.lang.NoClassDefFoundError: FirstLine/class

I'm using Windows XP Pro with Java Runtime 1.4.0.
Can anyone help me? Any help would be great.
Thanks
Jul 17 '05 #1
4 2401
Allan,

Newbie mistake #23: The argument to the Java launcher (the "java"
command) takes _class_ names, not class _file_ names as arguments.

By including the ".class" suffix you instructd the Java launcher to
invoke the "main" entry point in the class named "FirstLine.class"
while I'm sure the class you wrote is called simply "FirstLine".

Also, get the latest J2SDK, which is now 1.4.2. Bugs are routinely
fixed, performance improved and library API enhancements added.

Similar complaints ("java.lang.NoClassDefFoundError" can result from
class-path and package naming problems. Be sure you understand these
concepts and the java launcher options and environment variables that
pertain to locating class files.

Good luck.

Randall Schulz
Allan Robertson wrote:
Hello

I've downloaded the Java SDK 1.4.0 from Sun's website in the hope
to learning Java, however when I compile my *.java files this (at
most times) works fine, however when I run the *.class file using
java.exe I get this error message.

D:\jdk1.3\bin>java FirstLine.class

Exception in thread "main" java.lang.NoClassDefFoundError:
FirstLine/class

I'm using Windows XP Pro with Java Runtime 1.4.0. Can anyone help
me? Any help would be great.

Thanks


Jul 17 '05 #2
Phil,

There is a convention in the Sun Java tools to map package nesting
structures (with package names separated by dots, of course) to
directories separated by slashes. That's what you're seeing in that
exception diagnostic.

Randall Schulz
Phil... wrote:
A minor tweak on your otherwise excellent explanation. Note the
error message says FirstLine/class It thinks the dot means to go to
a subdirectory similar to what is done with import statements.


Jul 17 '05 #3
Thanks for your help, the code compiles fine now. I took your advice and
downloaded the 1.4.2_01 SDK fron Sun. Thanks :)

"Randall R Schulz" <rr******@cris.com> wrote in message
news:RG********************@typhoon.sonic.net...
Allan,

Newbie mistake #23: The argument to the Java launcher (the "java"
command) takes _class_ names, not class _file_ names as arguments.

By including the ".class" suffix you instructd the Java launcher to
invoke the "main" entry point in the class named "FirstLine.class"
while I'm sure the class you wrote is called simply "FirstLine".

Also, get the latest J2SDK, which is now 1.4.2. Bugs are routinely
fixed, performance improved and library API enhancements added.

Similar complaints ("java.lang.NoClassDefFoundError" can result from
class-path and package naming problems. Be sure you understand these
concepts and the java launcher options and environment variables that
pertain to locating class files.

Good luck.

Randall Schulz
Allan Robertson wrote:
Hello

I've downloaded the Java SDK 1.4.0 from Sun's website in the hope
to learning Java, however when I compile my *.java files this (at
most times) works fine, however when I run the *.class file using
java.exe I get this error message.

D:\jdk1.3\bin>java FirstLine.class

Exception in thread "main" java.lang.NoClassDefFoundError:
FirstLine/class

I'm using Windows XP Pro with Java Runtime 1.4.0. Can anyone help
me? Any help would be great.

Thanks

Jul 17 '05 #4
Have you added '.\' to the CLASSPATH variable
add the line
SET CLASSPATH=.';%CLASSPATH%
in your c:\autoexec.bat
HTH
Saurabh
"Allan Robertson" <no****@nospam.com> wrote in message
news:xj**************@news-binary.blueyonder.co.uk...
Hello

I've downloaded the Java SDK 1.4.0 from Sun's website in the hope to
learning Java, however when I compile my *.java files this (at most times)
works fine, however when I run the *.class file using java.exe I get this
error message.

D:\jdk1.3\bin>java FirstLine.class

Exception in thread "main" java.lang.NoClassDefFoundError: FirstLine/class

I'm using Windows XP Pro with Java Runtime 1.4.0.
Can anyone help me? Any help would be great.
Thanks

Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Sofia | last post by:
My name is Sofia and I have for many years been running a personals site, together with my partner, on a non-profit basis. The site is currently not running due to us emigrating, but during its...
7
by: Mike Kamermans | last post by:
I hope someone can help me, because what I'm going through at the moment trying to edit XML documents is enough to make me want to never edit XML again. I'm looking for an XML editor that has a...
15
by: drdoubt | last post by:
using namespace std In my C++ program, even after applying , I need to use the std namespace with the scope resolution operator, like, std::cout, std::vector. This I found a little bit...
9
by: sk | last post by:
I have an applicaton in which I collect data for different parameters for a set of devices. The data are entered into a single table, each set of name, value pairs time-stamped and associated with...
3
by: Bob.Henkel | last post by:
I write this to tell you why we won't use postgresql even though we wish we could at a large company. Don't get me wrong I love postgresql in many ways and for many reasons , but fact is fact. If...
3
by: google | last post by:
I have a database with four table. In one of the tables, I use about five lookup fields to get populate their dropdown list. I have read that lookup fields are really bad and may cause problems...
4
by: Phil | last post by:
k, here is my issue.. I have BLOB data in SQL that needs to be grabbed and made into a TIF file and placed on the client (could be in temp internet dir). The reason we need it in TIF format is...
8
by: Sai Kit Tong | last post by:
In the article, the description for "Modiy DLL That Contains Consumers That Use Managed Code and DLL Exports or Managed Entry Points" suggests the creation of the class ManagedWrapper. If I...
2
by: Michael R. Pierotti | last post by:
Dim reg As New Regex("^\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}$") Dim m As Match = reg.Match(txtIPAddress.Text) If m.Success Then 'No need to do anything here Else MessageBox.Show("You need to enter a...
0
by: U S Contractors Offering Service A Non-profit | last post by:
Brilliant technology helping those most in need Inbox Reply U S Contractors Offering Service A Non-profit show details 10:37 pm (1 hour ago) Brilliant technology helping those most in need ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.