Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Page 3 of 3 FirstFirst 123
Results 51 to 54 of 54

Thread: How to referenc a class file. using only notepad and run cmd.

  1. #51
    Member
    Join Date
    Feb 2011
    Location
    Pittsburgh
    Posts
    62
    My Mood
    Angelic
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default Re: How to referenc a class file. using only notepad and run cmd.

    Dear Norm:

    Thanks again for the help I would never have worked out this lot.

    A couple of things, it seems strange that we can use methods from classes in the same base folder as the calling class.

    But why, with a java program can we not set the classpath in Notepad for a class anywhere on the computer on on the web for that matter? Why is java so deficient in such a basic construct of the language?

    I need to go and take a nap then read all about command prompts, bat. files and packages.

    Tell Workman cheers as well, I looked at my old posts and removed the capitals bit about "I tried this 20 times ....." I did not realize that it looked as though I was getting angry.

    Cheers.

    Space Monkey.

  2. #52
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: How to referenc a class file. using only notepad and run cmd.

    set the classpath in Notepad
    No idea what that means. My Notepad is an editor. I use it to create text files.
    If you don't understand my answer, don't ignore it, ask a question.

  3. The Following User Says Thank You to Norm For This Useful Post:

    SPACE MONKEY (May 14th, 2012)

  4. #53
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: How to referenc a class file. using only notepad and run cmd.

    Quote Originally Posted by SPACE MONKEY View Post
    A couple of things, it seems strange that we can use methods from classes in the same base folder as the calling class.
    Why is that strange? Java needs to know where things are in order to use them. The first place it looks is the current folder, then it looks at the classpath, where you can tell it where other things are. Note that classes in the default package are visible, but that doesn't necessarily mean they can be used from each other. Private classes and methods are still inaccessible.


    Quote Originally Posted by SPACE MONKEY View Post
    But why, with a java program can we not set the classpath in Notepad for a class anywhere on the computer on on the web for that matter? Why is java so deficient in such a basic construct of the language?
    Huh? How is that a deficiency, or even a basic construct? Also, as Norm pointed out, setting the classpath in Notepad doesn't make any sense. Notepad has no idea what a classpath is. You feed the classpath to the Java tools, so Java knows where to look for other files. But the reason your request doesn't make sense is that how should Java know what "anywhere on teh computer or on the web" means? Say I want to use a class named MyObject, and I tell it to look "anywhere on the computer or on the web". What does that mean? What happens if there are two MyObject classes in different folders? Which one should it use?

    Quote Originally Posted by SPACE MONKEY View Post
    I need to go and take a nap then read all about command prompts, bat. files and packages.

    Tell Workman cheers as well, I looked at my old posts and removed the capitals bit about "I tried this 20 times ....." I did not realize that it looked as though I was getting angry.
    Don't worry about it. I think part of the reason you're having so much trouble is that you're trying to completely understand something in theory before you actually need to use it in practice. I might recommend just using the default package for now, and by the time you need to use other packages, they'll make much more sense to you.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  5. The Following User Says Thank You to KevinWorkman For This Useful Post:

    SPACE MONKEY (May 14th, 2012)

  6. #54
    Member
    Join Date
    Feb 2011
    Location
    Pittsburgh
    Posts
    62
    My Mood
    Angelic
    Thanks
    15
    Thanked 0 Times in 0 Posts

    Default Re: How to referenc a class file. using only notepad and run cmd.

    Dear Norm and KevinWorkMan:

    The thing I do not have is a good grasp of the theory. More reading and a lot of trial and error.

    I have now got a starting point, but I will take your advice Kevin WorkMan and stick to building stuff that can be kept in the same package or folder for now and read up on batch files while building my website.

    Thanks again to both of you.

    Cheers

    SpaceMonkey

Page 3 of 3 FirstFirst 123

Similar Threads

  1. making a notepad with java netbeans
    By tobioleye in forum Member Introductions
    Replies: 1
    Last Post: May 10th, 2011, 07:46 AM
  2. Ok, Notepad class has returned!
    By javapenguin in forum What's Wrong With My Code?
    Replies: 0
    Last Post: April 1st, 2011, 09:50 PM
  3. Replies: 5
    Last Post: November 13th, 2010, 01:53 PM
  4. notepad as backend database
    By chinni in forum JDBC & Databases
    Replies: 0
    Last Post: October 21st, 2009, 01:48 AM