Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Java Package Problem

  • 05-04-2005 09:31PM
    #1
    Closed Accounts Posts: 26


    I'm sorry this is a very stupid question but it has been wreaking my head for awhile now.

    I have a big application (20+ classes), so I did the sensible thing and used packages for code re-use and optimisation. Everything was fine but now, when I made a few small changes (just gif changes) it won't compile. The code hasn't changed.

    From command line I get:
    ...packageA.packageB.class - cannot find class

    and then it gives out about all the methods being used in main class that came from the packed class etc.
    If I just run it, it still runs the old code without any package problem.

    Any thoughts, ideas?
    I've tried javac -d and all that. I can't use an IDE because I get the same problem there. I know that everything is where its supposed to.

    Thanks


Comments

  • Closed Accounts Posts: 17,208 ✭✭✭✭aidan_walsh


    Can we see the new and old code for comparision, please?


  • Registered Users, Registered Users 2 Posts: 7,546 ✭✭✭BrokenArrows


    by gif changes do you mean that you simply subustitued one picture file name for another.

    Are you sure that you didnt delete anything because a file name change like this would not cause an error like that.


  • Registered Users, Registered Users 2 Posts: 21,264 ✭✭✭✭Hobbes


    Jars are basically zip files. Open it in winzip (or rename to .zip and check in XP). You can see if everything is laid out correctly.

    As mentioned your change shouldn't of caused that problem.


  • Closed Accounts Posts: 26 Selket


    "by gif changes do you mean that you simply substituted one picture file name for another.

    Are you sure that you didnt delete anything because a file name change like this would not cause an error like that."

    Yep, thats what I meant and that wasn't they problem, it was how I noticed the problem. By making the change, I had to re-compile and then noticed that it wasn't finding the packages.

    But its all ok now though. I've discovered what was wrong. My sis was playing around with the laptop and I didn't notice that she had managed to change my classpath. She removed that all import '.' at the end. I could still see the jars (which is why it would still run) but neglected to notice the . gone
    *sigh*

    Thanks for the input though


  • Registered Users, Registered Users 2 Posts: 4,003 ✭✭✭rsynnott


    Check classpath is correct. Might be worth clearing CLASSPATH environment variables and doing it from the command line.


  • Advertisement
Advertisement