There is this problem happening to me most of the times. I have a workspace with .java files. and i have included all the jar files necessary to run those .java files.It works perfect. but, so now when i try and create one more workspace with the same .java files and include the jar files, even though the jar files are present , they are not being detected. why so. i also made the copy of jars and using them separately for both workspace. i even tried using same jars for both workspace, but not working.
Ok. I'm not very much expert in workspaces, but below are the few precautions I take:
1) Never, ever use same directory for workspace and code. Always keep you code out of workspace. That way, workspace related settings are not stored in code dir.
2) Try to avoid using multiple workspaces for same set of source code. If you need to use some projects for one application and some other projects for other application, it can be done within a same workspace - by opening and closing respective projects. However, if you keep workspace dir separate from code dir, then you can create as many workspace as you wish for same set of source code files.
I guess(its just a guess) you are using same dir for workspace and source code. Further, you are creating another workspace using same (or child) dir, which is messing up the settings.
However, whatever is the case, it must find those jars if you've provided them correctly. What is the error you are getting?
An Eclipse workspace is not some sort of common pool of mutually-shared resources. It is a container for Eclipse Projects. It also holds session information for the workspace user, but that's generally not of interest.
Each project in an Eclipse workspace is independent of every other project unless it is specifically configured to refer to one or more of those other projects. So just plopping down jars in a workspace is not sufficient for all the projects in the workspace.
One thing I used to do was keep a "library" project in my workspace where commonly-used jars would be kept for reference purposes. These days I don't do that since Maven is usually managing my jars, though.
An IDE is no substitute for an Intelligent Developer.
Joined: Jul 28, 2011
if the .java file is in default package it works fine, but if it's in some user defined package, it is not able to detect the jars. and the jar files are not in workspace. they are in other drives like D
Mohan Mehra wrote:if the .java file is in default package it works fine, but if it's in some user defined package, it is not able to detect the jars. and the jar files are not in workspace. they are in other drives like D
I still think that you've not added those jars to classpath and/or there's some issue in package creation (did you performed the steps like create package, giving name of package etc. or just created a new file in default package and started it with something like package com.test.myClass; etc.?)