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.

Results 1 to 4 of 4

Thread: Mysterious disappearing classes.

  1. #1
    Member
    Join Date
    May 2013
    Posts
    106
    My Mood
    Amused
    Thanks
    16
    Thanked 9 Times in 9 Posts

    Default Mysterious disappearing classes.

    So I built this card game program which I've discussed here before. After I worked out the bugs and got it running as a JAR file about 2 months ago, I didn't have anything to do, so I didn't much look at it after that. I moved on to other projects.

    I have 2 computers; a desktop at home which runs Windows XP and a laptop that runs Windows 7. I don't focus very well at home, so I often like to take my laptop to the library and work there, or if I have a class in the morning I'll stick around at school all day. Anyway.. I store all my programming projects in a Dropbox folder to make them easily accessible from the 2 different computers.

    By default, Dropbox locates its folder within a subfolder of the My Documents folder. As you may already know, Windows XP and Windows 7 put the My Documents folder in 2 different places. XP is C:\Documents and Settings\..... and 7 is C:\Users\... This wasn't really a big deal until I started studying PHP. Because PHP requires all code to be run through a web browser and run off some sort of server, I decided I needed to install XAMPP. I wasn't about to start working in some crummy text editor and uploading my code to a web space every single time I made the slightest change.

    Again, since I was working through 2 computers, I decided to use Dropbox. It seems like a no brainer, since XAMPP just installs in a XAMPP folder, and not the traditional C:\Program Files\... environment like most programs. But since the configuration files for XAMPP make references to other folders and files, I knew that the full path name would have to be the same on both computers. Therefore, the differing locations of the Dropbox folders was now a problem.

    The Dropbox client program luckily has a utility for moving the folder easily, which I used, and moved it to C:\Dropbox on both computers. After that, XAMPP was working great on both computers

    tl;dr, enough of the back story

    Now there's a new problem. The movement process meant I had to create a new Workspace in Eclipse, and then import my projects into the new workspace. No problem. I did this pretty painlessly and most everything worked (a database program I've been working with couldn't load the MySQL JDBC driver anymore, but I fixed that). However... one odd problem has come up that I can't seem to figure out.

    The .class files are gone for my HigherNumber program. The bin folder is just gone. All the source code is still there, as are all the .java files. I dunno why. It seems to have happened in the Dropbox folder transition.

    How can I get these .class files back? Is there a way other than starting a new project and doing a copy/paste of all the source code into the new project?


  2. #2
    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: Mysterious disappearing classes.

    The .class files are created by the compiler. Sounds like you just need to recompile your source to recreate them.

    Eclipse does this automatically by default, and you can set the destination of the created .class files in your project properties. By default it puts your .class files in a folder named bin, which is located next to your src folder. But all of this is customizable, so it's hard to say exactly what the case is for you.

    If you have any problems with your build path or compiler errors, eclipse might not be able to create the .class files. That's another thing to look into.
    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!

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

    mstabosz (August 1st, 2013)

  4. #3
    Member
    Join Date
    May 2013
    Posts
    106
    My Mood
    Amused
    Thanks
    16
    Thanked 9 Times in 9 Posts

    Default Re: Mysterious disappearing classes.

    Hmm... Curious. I couldn't figure out how to compile it. I haven't seen a compile option anywhere in Eclipse. Normally whenever I write up code I click the green triangle that looks like a "Play" button and that runs the code. Now it's just giving me the error Error: Could not find or load main class higherNumber.HigherNumber, I guess because the classes aren't there.

    However, I did find the Clean option under the Project menu, and that seems to have done the trick. Thanks Kevin.

  5. #4
    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: Mysterious disappearing classes.

    Yeah, the clean option will delete any old .class files and recompile everything for you. Look for a "build automatically" option in that same menu, as well as a "build project" option.
    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!

Similar Threads

  1. Netbeams having a mysterious glitch about a work directory not existing.
    By javapenguin in forum What's Wrong With My Code?
    Replies: 2
    Last Post: April 14th, 2012, 02:59 PM
  2. [SOLVED] Disappearing applet, where's it going?
    By bradleysm in forum What's Wrong With My Code?
    Replies: 1
    Last Post: January 29th, 2011, 09:41 PM
  3. [SOLVED] Grass disappearing :(
    By The_Mexican in forum What's Wrong With My Code?
    Replies: 2
    Last Post: July 18th, 2010, 09:09 PM
  4. Java is resetting my variables to zero, and other mysterious things
    By schcrosby in forum What's Wrong With My Code?
    Replies: 3
    Last Post: January 12th, 2010, 09:50 PM
  5. [SOLVED] Java program using two classes
    By AZBOY2000 in forum Object Oriented Programming
    Replies: 7
    Last Post: April 21st, 2009, 06:55 AM

Tags for this Thread