Skip to main content

A beginner shifting from .NET

1 reply [Last post]
gizmokaka
Offline
Joined: 2007-10-31

Hello to all of you Java experts.

I am very new to java, just started learning. I am developing in C# (in that also I am new)
and I want to obtain the ability to do programming in Java.

my question is very newbe like, and I am not even sure it's supposed to be posted here.

it like that, I am using the jdk on windows.

I wrote a simple program that I can't even check if it works cause I get a run time exception
saying Exception in thread "main" java.lang.NoClassDefFoundError: Triangle/class

the code is:

class Triangle
{
//static final int length = 7;
//static final int width = 7;
//static final int middle = width/2 + 1;
public static void main(String args[])
{
for(int i = 0; i < 7; i++)
{
for(int j = 0; j < 7; j++)
{
if(j >= 4 -i && j <= 4 + i)
{
System.out.print('*');
}
else
{
System.out.print(' ');
}
}
System.out.println('\n');
}
}
}

can you tell me why am I getting this.

the commands I use are:

javac Triangle.java

java Triangle

Any help will be very appreciated.
Thanks in advanced.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
tarbo
Offline
Joined: 2006-12-18

Run as follows:
[code]> java -classpath . Triangle[/code]