File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes java [hard coded address] ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "java [hard coded address] ?" Watch "java [hard coded address] ?" New topic
Author

java [hard coded address] ?

Jack Kay
Ranch Hand

Joined: Aug 01, 2004
Posts: 62
This doesn't make any sense:


Cheers!
Liam Tiarnach
Ranch Hand

Joined: Aug 06, 2004
Posts: 51
C:\>java C:/Super
Exception in thread "main" java.lang.NoClassDefFoundError: C:/Super C:\>java C:\Super
Exception in thread "main" java.lang.NoClassDefFoundError: C:\Super C:\>java Super
Bad Object!
Game Object!


well, let me ask you this question...
what happens if you typed this in ?

C:\>java Super.class

you get an error also, right...

it because in my example, i specified a file name, not a class name right ?
but the bigger question is, what does java.exe think you saying ?

it thinks that you have a compiled class called "class" in package "Super"...

so using your example... it looking for a compiled class literally called "c:\Super.class" located in the current directory C:\
but your compiled class is called "Super.class" which resides in C:\
and that why you get the error...

The reason you omit the .class extension is becaused it a given... all class files end with the .class extension, so all you need is the class name...

For further information :
J2SE SDK Tools and Utilities Documentation
http://java.sun.com/j2se/1.4.2/docs/tooldocs/tools.html
Sun's Java Tutorial:Lesson: Solving Common Compiler and Interpreter Problems
http://java.sun.com/docs/books/tutorial/getStarted/problems/index.html

Have fun...


- Liam...<br />- ' He who never sleeps... '
Jack Kay
Ranch Hand

Joined: Aug 01, 2004
Posts: 62
Well yeah, but I still need to know how to hardcode an address so I can finish this C# program that opens class files for me. And once that is complete, I'm going to make millions!?!!!
[ August 08, 2004: Message edited by: Jack Kay ]
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Note that the Java runtime environment locates needed classes through the CLASSPATH. You can specify the value to use for the CLASSPATH at runtime.

java -classpath C:\ Super
[ August 08, 2004: Message edited by: Dirk Schreckmann ]

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Jack Kay
Ranch Hand

Joined: Aug 01, 2004
Posts: 62
That works perfect, thank you! I was looking at classpath myself and I couldn't get it to work, I thought it had to do with finding classes within JAR files lol. Thanks again!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: java [hard coded address] ?
 
Similar Threads
Calling main method outside of its class
Swing & Awt on Windows XP
Doubt regarding Classpath
using command to run swing application ?
running java program out of workspace