I have an xtext project that I want to move to another computer.
my text project uses some plug-in. if I want to compile my text project the log errors says it don't find the swt class.
adding the swt jar as a library or as a linked project doesn't work.
However, I have found this difference between the working project and the other.
the working one :
not working one:
the two projects have the same plugin dependencies :
any idea how to fix this?
Related
I am just starting with JavaFX and for some reason, Eclipse does not suggest to import JavaFX stuff so I have to type it in manually. Example: javafx.scene.Group I typed in Group as a type and it suggested other things such as javax.swing.GroupLayout.Group
image of suggestions
I'm not exactly sure, but I think maybe the fact that the JavaFX library is under Modulepath instead of Classpath has to do with it, but it only works if it is under Modulepath.
Help would be greatly appreciated, thanks!
I'm rewriting this answer, as #kleopatra pointed out it was inexact
For suggestions to work, you need to have JavaFX on your project's build path.
If you've created a plain Java project in Eclipse, with a module-info.java at it's source path root, then you need to add all the required jars to the module path:
JavaFX SDK should already be installed on your system, or download it from Gluon and unzip it
Right-click your Java project, got to Build Path -> Configure Build Path...
Go to Libraries tab, point to the Modulepath section
Click [Add External JARs...] button, pick all the jars from JavaFX SDK, hit [Apply and close]
Then suggestions should work as expected, and imports will be automatically inserted at the top of your java files, but they will appear in error the first time you import anything from a given library module, as this module must also be required in your module-info.java. You can do that automatically with a quick fix ("Add 'requires javafx.something' to module-info.java") when hovering the import.
Now there's a more straightforward way to create a JavaFX modular project in Eclipse, using Maven:
Create a new Maven Project
Check and pass the first wizard screen
Select archetype org.openjfx:javafx-archetype-fxml
On the next screen, you can select the JavaFX version of your choice (currently 13 by default)
After the wizard terminates, you've got a nice little project already setup with an application window and two FXML sample displays. You can start from there to build your own project.
I'm using the Eclipse IDE Mars and I made a maven project.
I did dependency setting, file generation, code writing, and so on.
At first, it was fine, but at some point, the error 'maven java e configuration process - an error occured while filtering resources' appeared in the project.
So to solve the problem, I clicked on the project and clicked maven->upgrade project, and the error disappeared, but the above icon appeared. What does this icon mean?
It's simply a feature of Eclipse where everything that belongs to test sources is visualized with darker icons.
Classpath separation via test source prevents JUnit and other test libraries and code from being used accidentally in the main code (src/main/java).
Since Eclipse Photon, in Java Maven projects source folders containing test code (src/test/java) are marked automatically as test source.
IntelliJ newcomer here. I'm having some issues getting my project dependencies working:
So I have a project called ClearDialogue. It's an IDE for making branching dialogue for video games. It relies on my other project, Clear (ClearVG and ClearWindows) for creating its window and also rendering the UI. ClearDialogue also depends on LWJGL3 and a few other dependencies. The projects use Maven to manage its dependencies.
Clear is a project on my machine that I've set up in IntelliJ and successfully ran its demos. ClearDialogue however is where my trouble started; it relies on Clear to work, which is another project (not a JAR thats uploaded for it to fetch). So what I'm saying is: I need to be able to use another IntelliJ project as a library in ClearDialogue.
According to other similar questions, I can achieve this by referencing the other project in the pom file of the project that's referencing it. So I did that and it actually did appear in the "External Libraries" dropdown:
.
There are a few problems:
1) Despite Clear appearing in the External Libraries section, it's still not being recognized by the IDE as a library and when I try to build the project, errors like this are printed to the console:
.
2) It seems that Clear is the only library being downloaded despite LWJGL3 and other libraries being designated as dependencies in the pom file. They aren't being downloaded and aren't appearing in the External Libraries tab. That said, Clear itself uses some of the same libraries (LWJGL3) so is it that it's just making sure they aren't duplicated? Either way, the code itself is drawing red lines because it can't find the LWJGL3 libraries.
Does anyone know ways to fix these issues? Thanks in advance.
I managed to fix both of these problems myself.
To solve the first problem of using another project as a dependency, I was able to use the maven attributes of the projects to do so. I referenced Clear in ClearDialogue's pom file like this:
.
Then I opened the Maven view (View -> Tool Windows -> Maven) and added the pom files from Clear's own modules to the list along with the needed modules within the project itself:
.
After this I pressed the "Reimport all Maven Projects" button (the button in the picture above that looks like a refresh button) and rebuilt the project (Build -> Rebuild Project). This successfully downloaded all of my needed libraries and successfully added the local libraries from my own projects only available on the machine as well. With that I was able to successfully run to program as well.
As for the second half of my problem, I was able to find this answer from another question here on Stack Overflow, which coincidentally was how I was able to figure out how to add local dependencies as well.
I'm trying to test Eventuate (framework JAVA that implement event sourcing) But I have a huge feature with eclipse, when I imported the project eclipse display the same files a lot of time.
For information the project is a spring-boot project using gradle.
This is a screen shot:
Would do you have an idea why this happens ?
Use the Package Explorer instead of the Project Explorer, and you won't get the second duplicate.
I am using Eclipse to develop an Android board game.
I have developed the UI in an Android project.
On the other hand, I have developed the AI in a regular Java project, because I wanted to be able to test it without all the constraints of the Android emulator (I didn't find any other way to run the code using my Windows JVM).
Now comes the times when I want to 'join' both projects (which work fine independently), that is to use the AI Java classes from the UI.
This is what I have tried:
In my Android project Properties > Projects References, I ticked the Java project.
This allows me to build without error the Android project (which instantiates an AI object).
But it fails at runtime with this error:
Could not find class 'my.package.AI', referenced from method my.otherpackage.UI.onStart
What would be the correct way to include the AI Java Project into my Android Project ?
(NB: I still want to be able to develop and test the AI as a regular Java app, so I think using a jar or copying all the sources to the Android Project would not suit my needs)
EDIT:
I was hoping that the new ADT v17 would solve the problem, but it didn't. I have tried virtually every option available to include a project in my Android project:
Adding or linking a source folder
Adding a Project (Java Build Path > Projects tab)
Adding a Class Folder or a Library (Java Build Path > Library tab)
Ticking all the previously imported projets/libraries as Exported
The only way that allows compiling and running without error is adding the JAR of the Java Project to the Android project build path.
Projects References only add the dependent project source code (your AI project) as a soft (perhaps weak is a more accurate word) reference, your AI project is not added into you Android Project Build path. so the actual ai.jar is not exported into the final apk when Eclipse build your app.
You should add AI project into Android project build path:
Right-click on your android project, select Build Path - Configure Build Path, in Projects tab (Required projects on the build path), add your AI project here.
Then in Order and Export tab (Build class path order and exported entries), tick your newly added AI project appeared int the list.
Step 2 is probably optional, this should add AI project as a reference in Android project and export the ai.jar to final.apk when Eclipse build your Android project.
Update from ADT 17.0.0:
Android Dev Team just release SDK r17 with ADT 17.0.0, which claims to handle this use cases properly now:
Eclipse specific changes
The dynamic classpath container called “Library Projects” has been renamed to “Android Dependencies” as it now contains more than just Library Projects.
The container will now also be populated with Java-only projects that are referenced by Library Projects. If those Java projects also reference other Java projects and/or jar files they will be added automatically (jar files referenced through user libraries are supported as well).
Important: this only happens if the references are set to be exported in the referencing project. Note that this is not the default when adding a project or jar file to a project build path.
Library Projects (and the content of their libs/*.jar files) is always exported. This change only impacts Java-only projects and their own jar files.
Again, duplicates (both projects and jar files) are detected and removed.
More in this link.
Edit: After much testing, reading and found my solution. Problem is (as of this writing) that you can't reference another project from an Android project, although it works fine for a normal Java application project.
Workaround for me (Windows with NTFS filesystem):
In a prompt (admin rights) make a symbolic folder link using mklink /D command pointing to your source project folders, and refresh in Eclipse as needed.
The obvious limitation is you cant use the same package names in source project and target project, and then there is the problem with libs in the common project.
example:
cd \java\workspace\AndroidProject\src\your\package
mklink /D common c:\java\workspace\CommonProject\src\your\package\common
Clarification: You can reference another project from an Android project to make it compile, however when you run, the referenced classes from the included project are not put in the apk classes.dex (verified with dex decompiler).
Using ADT 21.0.0 64bit on Windows 7 64bit. I tried adding project to build path. Ticked in the Order and Export, played with order. I read the official solution, the detailed explanation of that solution, exported as JAR, added to libs. Did not work, while the source was without errors. Read in the comments that the solution didn't work for everyone.
Was fed up with it and tried a simple but somewhat messier solution: linked the Java project's source to the Android project. That did the trick. Hope that this will help others too.
Don't add it to the project references area, instead go into the Android pane (in the Project Properties), scroll down to the bottom, and add it under Libraries.
This sometimes works but sometimes produces bizarre Eclipse issues (not sure why), in which case copying the jar directly into the project seems to work best.