Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Exception in thread "main"

Posted on 2004-08-05
2
Medium Priority
?
356 Views
Last Modified: 2010-03-31
i have created a folder com. In this folder i have created the following file


package com; public class Hello {            public static void main(String[] args)       {            System.out.println("Hello World!");      }}



I compile it using
D:\>javac com\Hello.java

But i am unable to run it. i get the following error
Exception in thread "main" java.lang.NoClassDefFoundError: com/Hello


when i do D:\>java com.Hello
Please help
0
Comment
Question by:niti20
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 92

Accepted Solution

by:
objects earned 200 total points
ID: 11733251
try:

java -classpath d:\ com.Hello
0
 
LVL 92

Expert Comment

by:objects
ID: 11733262
or if you are running it from d:\ then you an use:

java -classpath . com.Hello

To avoid having to specify it on the command line then add d:\ to your CLASSPATH environment variable
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This video teaches viewers about errors in exception handling.
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question