Hi
I am trying to get Java to work (not easy I know)
Assuming i'm in ~/Java
which has src, javadoc and classes
So I ran:
classpath=./classes/
CLASSPATH=./classes/
( both echo out ./classes/ now )
I make a Test1 directory in src and a file Address.java in src/Test1
this has
So I run javac -d ./classes/ src/Test1/Address.java
No errors, so one would imageine it worked.
Now, to test it works i issue java Address
expecting to to to the next prompt, but instead it yeilds:
So I look to see if it exists, and sure enough ./classes/uk/co/jsa3d/AP3/Test1/Address.class exists
So adding -classpath ./classes/ so it knows where the classpath is should fix it, or at least thats what I would've thought but it doesnt . If I give it the full classpath to the Test1 directory, it changes its complaint to Wrong Name.
So, is it just me or does this not somewhat defeat the point in classpath and packages ?
How can i get it so all I need to do is run java Address and it'll execute properly? (Granted, at present it wont attually do anything but it should execute it)
I am trying to get Java to work (not easy I know)
Assuming i'm in ~/Java
which has src, javadoc and classes
So I ran:
classpath=./classes/
CLASSPATH=./classes/
( both echo out ./classes/ now )
I make a Test1 directory in src and a file Address.java in src/Test1
this has
Code:
package uk.co.jsa3d.AP3.Test1;
public class Address {
public static void main(String[] argv) {
}
}
So I run javac -d ./classes/ src/Test1/Address.java
No errors, so one would imageine it worked.
Now, to test it works i issue java Address
expecting to to to the next prompt, but instead it yeilds:
Exception in thread "main" java.lang.NoClassDefFoundError: Address
So I look to see if it exists, and sure enough ./classes/uk/co/jsa3d/AP3/Test1/Address.class exists
So adding -classpath ./classes/ so it knows where the classpath is should fix it, or at least thats what I would've thought but it doesnt . If I give it the full classpath to the Test1 directory, it changes its complaint to Wrong Name.
So the only way I can execute it is to give it the full class name and the classpath:#Exception in thread "main" java.lang.NoClassDefFoundError: Address (wrong name: uk/co/jsa3d/AP3/Test1/Address)
Code:
java -classpath ./classes/ uk.co.jsa3d.AP3.Test1.Address
How can i get it so all I need to do is run java Address and it'll execute properly? (Granted, at present it wont attually do anything but it should execute it)