File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

packaging and class path? weird problem

 
osgaldor Storm
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi:

I've been writing java for about a year now. I took a semester of it in college and I love it! In our class, however, we only used Netbeans and spent only a few minutes in one class period talking about compiling at the command line. I have a program I've been working on for some time, but it's kicking my butt. I have the class built and a main class to instantiate and run my class. i want my program to run at the command line, but when I go to compile it at the command line, the compile fails because it says it can't find my class that I built. It's in the same directory with the main class and I have them under the same package name.

What's weirdest about it is that when I run it in Netbeans, it's beautiful, runs exactly as it should, but it won't even compile outside of Netbeans. It's so frustrating, and I can't figure out what in the world is wrong. I've been pouring through all my java books and the closest I can get is that it may have something to do with the package and the classpath.

Can anyone help me figure out what I'm doing wrong?

Stormy
 
Saif Asif
Ranch Hand
Posts: 440
Eclipse IDE Hibernate Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello osgaldor Storm ,

Can you please provide more information ?

1) What is the command you use to compile and then execute from the command line

2) what is your package hierarchy ?

3) can you share the code you are trying to compile ?
 
osgaldor Storm
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am compiling with javac age.java

i'm running with java age

The package structure is just one level package age;

Would you like me to post the code for my class or the main method class? i can give you any or all of it.

Thanks!
 
Saif Asif
Ranch Hand
Posts: 440
Eclipse IDE Hibernate Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just tell me are you using any external classes or just the core java classes ? By external classes I mean is your code dependant on any jars like e.g log4j.jar or junit.jar etc etc ?

Yes do share the code for the myclass and main method both
 
Campbell Ritchie
Sheriff
Pie
Posts: 47293
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch
As Saif Asif says, we cannot help unless we know all about your folder structure and which directory you are trying to compile from.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic