Solved

Exception in thread "main"

Posted on 2004-08-05
2
350 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
  • 2
2 Comments
 
LVL 92

Accepted Solution

by:
objects earned 50 total points
Comment Utility
try:

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

Expert Comment

by:objects
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
stringclean challenge 26 53
wordappend challenge 8 82
Python Assistance 7 30
@SBGen Method 3 25
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now