Project is Missing Required Source Folder: "src_ex_common" - classpath

I try to open the sample project from google opensource as provided in the following link:
https://android.googlesource.com/platform/packages/apps/Calendar.git
I have imported the 5 git repositories as required in the program but there is still a red exclamation mark near the project and the "Problems" suggested the project is missing required source folder "src_ex_common". I right click the project name => Properties => Java Build Path => Source, i saw
"MainProjectActivity/src_ex_common (missing)".
I right clicked the project name => new=>source folder and attempt to name a new folder called "src_ex_common" but eclipse said The folder is already a source folder. Then i tried to name a new folder called "src_ex_common" in Windows. The problem above is solved but there are many errors then appear in various java files under src.
I googled that some said this might be due to the problem in ".classpath"
The detail of .classpath is listed below:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src_ex_common"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
Did anyone encounter this problem before? Great if u would share your approach to tackle it. Many thanks!

If you open the mkprojectfile file in the root folder, you will see that the src_ex_common folder is linked to the commons library:
<link>
<name>src_ex_common</name>
<type>2</type>
<location>SRC_ROOT_DIR/frameworks/ex/common/java</location>
</link>
You can import this project from the same ex repository that contains the chips dependency.

Related

Glassfish 4, Eclipse IDE 2019-03 - CustomRealm: AppservPasswordLoginModule cannot be resolved to a type

I would like to implement a Custom Realm by overriding the security classes but I'm getting an error:
AppservPasswordLoginModule cannot be resolved to a type
The import com.sun.appserv cannot be resolved
I followed the steps from this tutorial: https://computingat40s.wordpress.com/how-to-create-a-custom-realm-in-glassfish-3-1-2-2/
What I did:
I created a new java project
Added a new lib folder to my project.
Copied the security.jar(also tried with security-ee.jar) from $glassfish-installation-folder\glassfish\modules to lib folder
I added this line to my .classpath file:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="lib" path="lib/security.jar" />
<classpathentry kind="output" path="bin"/>
</classpath>
I also tried to add the jar to build path using Eclipse GUI
NOTES: I'm not using MAVEN, I also tried to clean the project as it was mentioned in other answers
After making this steps Eclipse throws me an arror when I want to extend MyCustomModule with AppservPasswordLoginModule:
enter image description here
UPDATE!
I found the JAR that must be added to JAVA build path: glassfish-ee-api.jar
I solved the problem by creating a new library where I copied all the JARS from $glassfish-installation-folder\glassfish\modules
Photo

I am having trouble using the Jsoup library on my project

I downloaded the latest Jsoup and moved it to my workspace in finder. I then added it to the ClassPath thing under the Project Properties. However when I try and import Jsoup classes/packages in the code, I get an error that says the element cannot be resolved. Is there any other thing I should check to ensure that the software usable?
This is for an Eclipse project that I am using to practice scraping.
I'll show you how I'm doing it and what's the result.
Adding Jsoup library to project:
Then it looks like this:
Then when I peek into my .classpath file it has a new line with jsoup path:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre1.8.0_161"/>
<classpathentry kind="lib" path="F:/lib/jsoup/jsoup-1.12.1.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
This way every import to Jsoup classes is easily recognized and missing imports are resolved without problems.

Gradle/Eclipse issue when importing projects

Have been using Gradle with Eclipse on a multi-project development effort for over two years. During that time, every once in a while (maybe after changing branches too often) Eclipse gets confused. Deleting the projects (not their contents) and re-importing fixes it every time. Typically, I have needed to do this about once every two months. No big deal! Import is done within Eclipse via the Import->Gradle Project -> build model process.
I needed to do this again recently after upgrading to the latest packages. Now compilation and execution (running Unit Tests for instance) within Eclipse works fine; but debug has lost all the inter-project dependencies. I can no longer set a breakpoint on code in Project 2 and run something from Project 1 and have the source code display. Instead, I get the "Edit Source Lookup Path" window when the breakpoint is hit.
I have Eclipse Luna Release 2, version 4.4.2, Spring IDE 3.6.4.201503051146-RELEASE, and Gradle IDE 3.6.4.201503050952-RELEASE. My gradle wrapper is version 2.3.6, and I am on a Mac OS X 10.10.3
The previous .classpath files looked like:
<classpath>
<classpathentry kind="src" output="build/classes/main" path="src/generated/java"/>
<classpathentry kind="src" output="build/classes/main" path="src/main/java"/>
<classpathentry kind="src" output="build/resources/main" path="src/main/resources"/>
<classpathentry kind="src" output="build/classes/test" path="src/test/java"/>
<classpathentry kind="src" output="build/resources/test" path="src/test/resources"/>
<classpathentry exported="true" kind="src" path="/proj1.main"/>
<classpathentry exported="true" kind="src" path="/proj2.main"/>
<classpathentry exported="true" kind="src" path="/proj3.main"/>
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry exported="true" kind="con" path="org.springsource.ide.eclipse.gradle.classpathcontainer"/>
<classpathentry kind="output" path="target"/>
which has three dependent projects then show up on the Java Build Path, Projects tab. Now, none show up but the projects appear under Gradle Dependencies on the Libraries tab (so compiling and running still works).
I imported the same way I have for over two years, so that is not it. Additionally, there are some new options on the Preferences->Gradle tab. I tried with "Remap Jars to Gradle Projects" and "Use Custom Tooling Model).
Does anyone know how to make it work the way it has been working? I really do not want to generate the eclipse files from the command line.
try cleanEclipse and also check the .bin directory and see if the class files are there as this is how gradle plugin use to debug.
Hope that helps.

Eclipse relative ClassPath question

New Eclipse user here with a quick question:
I tried changing the following line in my workspace .classpath file to solve a build error that cannot find a referenced project.
<classpathentry combineaccessrules="false" kind="src" path="/EventNotifier"/>
to
<classpathentry combineaccessrules="false" kind="src" path="../EventNotifier"/>
After doing this, I get the following error:
Illegal entry in '.classpath' of project 'occ600server' file: Path for IClasspathEntry must be absolute
Referenced folder in not in same directory as .classpath file but one level up. How do I fix this?
TIA.
You can use a classpath variable for this purpose.
Go to the workspace preferences, Java > Build Path > Classpath Variables
Create a new variable named WORKSPACE_ROOT (or whatever)
Use a <classpathentry ... /> of type var and put your variable at the start of the path attribute without any fancy ${} business.
Like so:
<classpathentry kind="var" path="WORKSPACE_ROOT/project/lib/somelibrary.jar" />
This technique is used by mvn eclipse:eclipse among other things.

precedence of persistence.xml in hibernate project

I have an eclipse project with several jars for JPA / Hibernate. One of tham contains a META-INF/persistence.xml and I want to override that by defining my own persistence.xml. So I tried using my persistence.xml in src/persistence.xml also src/META-INF/persistence.xml but everytime it seems jar/META-INF/persistence.xml gets picked up.
I also tried editing .classpath file of eclipse projects and moved up classpathentry path="bin" higher up than the library included but still its not picking up my persistence.xml
<classpath>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/main/rules"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
<classpathentry kind="con" path="DROOLS/Drools"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/drools"/>
</classpath>
In the tutorial I read:
You will need to override these
defaults if you want to change them,
by adding your own persistence.xml in
your classpath, preceding the default
one in drools-persistence-jpa.jar
So I tried using my persistence.xml in src/persistence.xml also src/META-INF/persistence.xml but every time it seems jar/META-INF/persistence.xml gets picked up.
The persistence.xml should be located under META-INF/persistence.xml so the first attempt won't work. And when I look at your .classpath file, I don't see src as source path so the second attempt won't work either.
Try src/main/java/META-INF/persistence.xml instead.
Actually, your project layout really looks like a Maven layout and with Maven, resources typically go to src/main/resources or src/test/resources. But since you didn't mention what tutorial you're following, I can't confirm if this applies here.
Anyway, my suggestion should work.