whats even more is that if i create any new file in the "src" folder of the project , it doesnt create any new bin folder to place the class file. i dont know where the class files are of the compiled source code . only when i manually javac -d ..\bin test.java-d a test code from the cmd, a new bin folder got created.

anyone have any idea why this is happening ?

i had the project folder synced to a repository on github , and the repo has all the bin and the class files , but when i try to pull from the repo , it says successfully pulled , but no class files are getting downloaded into my hard disk.

update : deleting the project folder , and making a fresh clone of the github repo solved some of the problems , mainly :

  1. compiling code from eclipse auto popularizes the bin folder with class files.
  2. hitting run from eclipse no longer says : cannot find main class (as a consequence of above point)

but i would still love to know if someone has any opinion about the initial problem. what may have caused it , and has anyone else faced something like this.

thanks for your time.
regards.

You almost never push autogenerated class-files to your repository unless it's in the form of a JAR. Even JARs can be avoided by providing relevant ant files or maven files for that particular project in which case the user can just build the entire thing on his own.

For your particular problem, not much can be said without looking at the actual repository but if your "pushed" project to github had some absolute paths somewhere in the config, there can be issues. There are also Eclipse project configurations available which put your generated class files in a different folder as opposed to the default 'bin' folder. That might be one of the reasons. Instead of searching for 'bin' folder, you should have searched for the .class files.

commented: valuable info +3

On a related note, this is one of the reasons why you build an Ant or a Maven project since that way you don't end up uploading IDE specific stuff. Since you are already on Github, search around for other Java projects and look at how they manage project dependencies + structure using something like Maven or Gradle. The Eclips Maven plugin m2e makes it simple to create a Maven project.

im yet to work with ant or maven (quite new to java still) and didnt have much idea about good posting habits on github. ill look into these.

you should have searched for the .class files.

umm , im not sure what that meant , the class files were inside the bin , and the bin had itself vanished.

regarding github practices , iv seen some people post onlythe source files , is that good ?
so far , i work alone , and i use eclipse when things get complicated , so i thought of uploading the entire project "as-is" so that if i have to explain sommething to some friends , i can just directly pull stuff from the repo into a different machine and not have to worry about their settings. a double bonus i felt was that it could act as a backup.
not a good practice it now seems to be.

umm , im not sure what that meant , the class files were inside the bin , and the bin had itself vanished.

I mean when you realized that you didn't have a bin folder, instead of searching for that folder, you need to search for the .class files. Assuming your Eclipse preference is to build automatically, the class files have to be generated somewhere. If not in bin then in some other folder. Unless of course Eclipse starts acting weird and refuses to generate the class files.

regarding github practices , iv seen some people post onlythe source files , is that good ?

That's the norm; almost always, source control is for source code, config files and scripts. Except in some cases like game development in which assets are checked in too as a backup.

so far , i work alone , and i use eclipse when things get complicated , so i thought of uploading the entire project

Nothing bad about that as long as you know how an ideal project should look like. Just make sure that whenever you are uploading an Eclipse specific project, you:

  • Upload the .project file
  • Upload the .settings folder
  • Skip bin and target folder
  • check if the .classpath file contains absolute paths. If it does, no point in uploading it. Otherwise if it refers relative projects, you can upload it as long as the person checking out that project also checks out the dependent projects.

a double bonus i felt was that it could act as a backup.

Think about it, a backup of .class file is never required. If you have a valid compilable project, you can always generate the .class files. This is much more important because it doesn't assume the JDK version of the end user. If your project supports Java 1.4+, folks can use JDK 1.4, JDK 5 and JDK 7 to compile their projects instead of using your JDK generated class files.

commented: good ans , me wants to give reputaion , hence forced to make a crappy comment :P +0

thanks a lot for your help :)
marking thread solved :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.