Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem with starting program

1 view
Skip to first unread message

Igor Hasimi

unread,
Apr 20, 2002, 5:42:17 PM4/20/02
to
Hi to all,
I have one problem when I want to start java program under windows and
jaav is 1.4.0. Fielname is po.java
andit is in package i1 in directory i1. when i try to start it with java
po I get this error:

cd i1
java po
Exception in thread "main" java.lang.NoClassDefFoundError: po (wrong name:
i1/po
)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:509)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
3)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:246)
at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
at java.net.URLClassLoader$1.run(URLClassLoader.java:193)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:322)

Can someon tellmi what is the problem?
Thanks in advanced
Igor


--

______
/__ _\
\/_/\ \/ __ ___ _ __
\ \ \ /'_ `\ / __`\/\`'__\
_\ __/\ \L\ \/\ \L\ \ \ \/
/_____\ ____ \ ____/\ _\
\/_____/\/___L\ \/___/ \/_/
/____/
_/__/

Chris Wolfe

unread,
Apr 20, 2002, 6:13:17 PM4/20/02
to
Igor Hasimi wrote:
>
> Hi to all,
> I have one problem when I want to start java program under windows and
> jaav is 1.4.0. Fielname is po.java
> andit is in package i1 in directory i1. when i try to start it with java
> po I get this error:
>
> cd i1
> java po
> Exception in thread "main" java.lang.NoClassDefFoundError: po (wrong name:
> i1/po
> )
[snip]

>
> Can someon tellmi what is the problem?
> Thanks in advanced
> Igor

Your friendly Java runtime already did: class "po" not found, name
was "il/po".

The way Java packages work you, classes need to be in directories off
the CLASSPATH according to their packages. So assuming the usual case
where the CLASSPATH includes the current directory, you would need to
put the po class in an il subdirectory. Then run:

java il.po

where java will look in the il subdirectory, find po.class, and
execute it happily.

Unti you get comfortable with Java you may want to remove the package
declaration from the .java source file. It should then work as you
originally expected it to.

Cheers,
Chris
Cheers,
Chris

Chris Wolfe

unread,
Apr 20, 2002, 6:14:43 PM4/20/02
to
Chris Wolfe wrote:
[snip]

> Unti you get comfortable with Java you may want to remove the package

That would be "Until you get comfortable... ".
Note to self: Ignore button on spell-checker should not be a reflex.

Chris

grava

unread,
Apr 20, 2002, 9:01:01 PM4/20/02
to

"Igor Hasimi" <kom...@fon.fon.bg.ac.yu> ha scritto nel messaggio
news:Pine.GSO.4.10.102042...@fon.fon.bg.ac.yu...

> Hi to all,
> I have one problem when I want to start java program under windows and
> jaav is 1.4.0. Fielname is po.java
> andit is in package i1 in directory i1. when i try to start it with java
> po I get this error:
>
> cd i1
> java po
> Exception in thread "main" java.lang.NoClassDefFoundError: po (wrong name:
> i1/po

If file is po.java I think U have to compile in JavaCode before launching it
...
$ javac i1/po.java
$ java i1/Po

NB ... Usually po is Po, note the capital letter!! cos it's in syntax rules
for Java, class name as to be with capital letter Uppercase, so it create a
Po.class U can launch with java ....

Hi, Grava

0 new messages