473,378 Members | 1,543 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,378 software developers and data experts.

Still having problems with Java . . .

Ash
Hey. I've uninstalled netbeans, and installed just the SDK 1.4.2. I can
compile .java files from the command prompt, but EVERY time I try to run
ANY .class file, I get:

Exception in thread "main" java.lang.NoClassDefFoundError: Test/java

What am I doing wring, here?
Jul 17 '05 #1
3 1804
Ash wrote:
Hey. I've uninstalled netbeans, and installed just the SDK 1.4.2. I can
compile .java files from the command prompt, but EVERY time I try to run
ANY .class file, I get:

Exception in thread "main" java.lang.NoClassDefFoundError: Test/java

What am I doing wring, here?


Ash,

To run a java class file, you pass the fully qualified name of the class
to the java executable. The FQN is not the name of any file on your
file system. It is the name of the package your class is in followed by
the (short) name of your class.

For example, when I was testing your TestFrame class you posted, I did
the following:
[tmp]$ cat >TestFrame.java
import java.awt.*;
public class TestFrame
{
public static void main(String[] args)
{
Frame f = new Frame();
f.reshape(10,10,200,200);

Button b = new Button("Hello Cyberspace");
b.setBackground(Color.black);
b.setForeground(Color.white);
f.add(b);
f.show();
}
}
[tmp]$ javac TestFrame.java
Note: TestFrame.java uses or overrides a deprecated API.
Note: Recompile with -deprecation for details.
[tmp]$ java -cp . TestFrame

HTH,
Ray

--
XML is the programmer's duct tape.
Jul 17 '05 #2
> Hey. I've uninstalled netbeans, and installed just the SDK 1.4.2. I can
compile .java files from the command prompt, but EVERY time I try to run
ANY .class file, I get:

Exception in thread "main" java.lang.NoClassDefFoundError: Test/java

What am I doing wring, here?


It sounds like you didn't name the file the same as the class name.
OR - maybe you didn't import the needed classes for the app.
post your code.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.781 / Virus Database: 527 - Release Date: 10/21/2004
Jul 17 '05 #3
Hal Rosser wrote:
Hey. I've uninstalled netbeans, and installed just the SDK 1.4.2. I can
compile .java files from the command prompt, but EVERY time I try to run
ANY .class file, I get: Exception in thread "main" java.lang.NoClassDefFoundError: Test/java What am I doing wring, here?
It sounds like you didn't name the file the same as the class name.
OR - maybe you didn't import the needed classes for the app.
post your code.


It can be more confusing on Windows with a case insensitive
file system. You have to match the case of the class
name even if it isn't the case of the file name. The system
will find the file, but not the class.

-- glen

Jul 17 '05 #4

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

Similar topics

1
by: black hawk | last post by:
Hello, i have a big problems, to install oracle 9i v9.2 Server to my "Windows XP" with Service Pack 2 and all security and other updates from Microsoft. The "Universall Installer" (Standard...
0
by: black hawk | last post by:
Hello, i have a big problems, to install oracle 9i v9.2 Server to my "Windows XP" with Service Pack 2 and all security and other updates from Microsoft. The "Universall Installer" (Standard...
3
by: Alan Krueger | last post by:
Greetings, I've been able to cache Transformer objects in a Tomcat-based servlet application to avoid unnecessary Transformer rebuilding, except for certain ones on certain machines. I'm...
1
by: Jens Mueller | last post by:
Hi there, this is a Java-XML Question, so I am not sure whether this is the right place, haven't found anything better .... I try to convert a Java object to XML via SAX and let the FOP...
7
by: Grant | last post by:
Ok I have XP Pro and recently upgraded to SP2 but after doing so one of my favorite webpages to check daily does not respond the same as before. It used to be (pre SP2) that I could when visiting...
687
by: cody | last post by:
no this is no trollposting and please don't get it wrong but iam very curious why people still use C instead of other languages especially C++. i heard people say C++ is slower than C but i can't...
8
by: Michael C | last post by:
Hi all, I'm still having problems with VS.NET 2003 running on my XP machine. I finally decided I might as well uninstall completely and reinstall from scratch. But lo and behold it won't let...
0
by: Daniel Thune, MCSE | last post by:
I am having a problem with formatting a SOAP Header in a .Net client. The client calls a Java Axis 1.1 based web service. In order to authenticate the caller, the web service call is intercepted by...
24
by: John Salerno | last post by:
Since Python does so many things different, especially compared to compiled and statically typed languages, do most of the basic design patterns still apply when writing Python code? If I were to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.