Module not found error (JavaFX) -- running a cloned repo on my Eclipse - eclipse

Please help. I am trying to run an app that is cloned from a GitHub repository. I could run it fine from the terminal (with ./gradlew run (I'm using MacOS)), but if I open the project in Eclipse and run it from there, it fails. (My goal is not just to run the app on my computer but to run it from Eclipse so that I could add a feature or two in the future for personal use).
I searched for solutions all day and tried different things, but solving one error led to another.
What I've done in detail:
Open the project from "Open Projects from File System.."
Right click on the project and "Configure" -> "Add Gradle Nature" (Not sure if this is the right step to take)
Right click on project -> build path -> library -> move the "project and external dependencies" library (includes all jar files such as javafx-controls-17-mac.jar) from classpath to modulepath (This step gets rid of all errors except one within the src/test/java folder, which I believe does not directly affect running the app).
If I run the app I get the following error:
Error occurred during initialization of boot layer java.lang.module.FindException: Module javafx.controls not found
I tried adding
--module-path /Users/julie/.gradle/caches/modules-2/files-2.1/org.openjfx/javafx-controls--add-modules javafx.controls
under VM Arguments in Run Configurations but it would give me this error:
Error: Could not find or load main class javafx.controls
Caused by: java.lang.ClassNotFoundException: javafx.controls
The path is what I found by looking at "project and external dependencies" library that came with the code (provided by the author). Not sure if that's the right way to do it, but I thought it makes sense to use something within the cloned repo rather than downloading a new javafx and use that path.
I've tried many more things for 8+ hrs.. I don't recall all of them but here are some different error messages I got:
Error occurred during initialization of boot layer
java.lang.module.FindException: Error reading module: . . .
module-info 2.class found in top-level directory
I think the last error has to do with creating second .class files in bin folder.. I don't know what's causing it but I had to delete all duplicate .class files manually many times. (If somebody can tell me why this is happening, it will be greatly appreciated...)
I've never used Gradle nor JavaFX in my life so this might be a dumb question but please help me out.
FYI, the repo I cloned is
https://github.com/mfl28/BoundingBoxEditor.git

Related

Keep Getting Error When Trying to Run Javafx on Eclipse with Mac

So I keep getting this error when trying to run my program:
Error occurred during initialization of boot layer
java.lang.module.FindException: Module javafx.controls not found
I'm using a mac with eclipse, and my VM argument is:
--module-path /Users/myname/Desktop/javafx-sdk-11.0.2_3/lib --add-modules javafx.controls,javafx.fxml
I've tried everything, javafx.controls.jar and the other .jar file are in my lib folder. I've reinstalled the javafx program, changed my file path around hundreds of times, and I've tried to install plugins. Does anyone have any idea as too what can be happening? JavaFX is also an added library in my project, and all the .jar files assocated with it are added to it. Please let me know if anyone has an idea. Best!
I had success with the following additional step.
In the Run Configuration->Dependencies tab, click the "ModulePath" and then add the JavaFX JDK's jars (or the /lib folder that holds the jars) to the list.
You can inspect the generated command line, and check that these are included in the -p option.
IDK why this step should be needed. I would think Eclipse should be smart enough to include something on the dependency module path if it were in the project's Build Path Library list.
I have questions about this at eclipse.org and gluon. Maybe there will be an explanation, or fix so that this step isn't needed, or an edit to the documentation to let us know we need to do this.

IntelliJ IDEA 13: new Scala SBT project hasn't src directory structure generated

I followed the getting start video on Jetbrains website to setup IntelliJ IDEA 13.1 Community Edition to work with Scala. Scala plugin v0.36.431 had been installed. While I created a new Scala SBT project with wizard, there was no src/ directory structure generated in the project. Only two sbt files were generated:
scala-course/
├── build.sbt
└── project
└── plugins.sbt
From the video and other document I know that there should be a src/ directory structure, including src/main/scala, src/test/scala, etc. sbt uses the same directory structure as Maven for source files by default.
I can create those folders manually and mark it as source root. However it is trivial. So my question is: Why IntelliJ IDEA new project wizard doesn't generate the directory structure as said in document? Was I doing something wrong? I checked the preferences and couldn't find anything that seems related.
Normally it should create these folders automatically. It may take a while though - it takes couple of seconds in my case.
When creating project make sure you have selected Scala -> SBT, then proceed with the wizard.
Once the Finish is clicked, the project will be loaded. This part takes couple of seconds, and I can see no src/main/scala nor src/test/scala generated until it's done. Observe the bottom of the screen to see when it's done.
Once the process is finished, you'll see the folders.
If that's not the case, check the settings. You should have the Create directories for empty content roots automatically checked. You may want to check Use auto-import to automatically propagate changes in the build.sbt.
After changing the settings (if the change is required) you may need to refresh the project, as seen in picture below.
This can also happen if you do not have a JDK selected. For some reason you no longer get the option to select an SDK so you must make sure you have configured this before hand. To fix this do the following:
From the welcome screen, go to
Configure -> Project defaults -> Project structure and add the jdk.
Source:
What's the reason for "Error:Cannot determine Java VM executable in selected JDK"?
Thanks to lpiepiora, with his hint I find out the reason.
Because my sbt is newly installed, there is nothing in ~/.ivy2/cache/ and ~/.sbt/boot/. sbt needed to download required dependencies from repositories on network. It happened that my proxy to internet had something wrong, download stuck.
And also need to notice that, if quit IntelliJ IDEA when sbt is running in background, the next time you'll get error of waiting for some lock file. Have to remove the lock file on filesystem and restart IntelliJ IDEA again.
After fixed the network problem, everything work as promised. It requires several minutes, depends on network speed, to download required jar files. After finished, the src/ directory structure is created.
I followed the instructions in this thread but I had a java crash in the final phase in sbt with the configuration bellow and I think this info maybe useful:
The problem happened with IDEA 2016.2, sbt 0.13.8 (I tried later to import using 0.13.12 but the crash was the same), scala 2.11.8 and ubuntu 16.04.
The only way I could make it work was to use java 8 instead of 9.
error: error while loading package, Missing dependency 'object java.lang.Object in compiler mirror', required by /home/jbamaral/.sbt/boot at xsbt.boot.Boot.main(Boot.scala)
...
stack log here
...
[error] scala.reflect.internal.MissingRequirementError: object java.lang.Object in compiler mirror not found.

No Class Def Found Error in my JSP file

I have a jsp file called AddBidding.jsp which adds bids for a facility. I am using the Google App Engine's datastore (objectify). When I try to run the file using localhost:8888/AddBidding.jsp. However, it keeps giving me NoClassDefinitionFound Error. Can I know what causes this error? I know it's due to the classpath but how do I fix it in Eclipse GAE?
I am making some assumptions over here since there are not too many details about which class is giving you the NoClassDefFound Error. Just ensure that all the external(additional) JARs that you use are present in the WEB-INF\lib folder also. For e.g. put all the Objectify and dependent JARs in the WEB-INF\lib folder and then try.
Right Click the Project on Project Explorer View > "Configure Build Path"
In Source [tab] Make sure your Default output folder is right
In Libraries [tab] you have Web App Libraries
If not Add Library...
That should get you working.

Referencing a GWT project from another GWT one - Problems

I am already using an open source GWT project (iServe) and I would like to integrate into it another open source GWT project (PetalsBPM), by which I mean being able to call it and reference its methods.
I have imported iServe in Eclipse (it has multiple modules) as separate Maven projects referencing its other and can run it successfully through Runas -> Web application in development mode.
If I do that and run the other project through the console as mvn gwt:run, I call initiate PetalsMBP through iServe. However, that means that the two programs have to run as is, without communication with each other.
I have also imported the second project into eclipse as a java project successfully (converting into a Maven one causes problems - various lifecycle configurations ones), but whenever I try to add to to iServe through Properties -> Java Build Path -> Projects, although it does not cause any errors immediately, I cannot launch iServe anymore. It produces the following error:
"Exception occurred executing command line.
Cannot run program "C:\Program Files\Java\jre7\bin\javaw.exe" (in directory "C:...iserve-sal-gwt-1.0.0-SNAPSHOT"): CreateProcess error=206, The filename or extension is too long"
Are my problems related to the fact that PetalsBPM is not a Maven project in Eclipse (I doubt it)?
Am I doing something wrong, i.e., this is not the way to reference a project from another one? should I add a reference to the first project's (iServe) gwt.xml file?
Is there a way to do what I want without having to wrap the second project as a jar and calling it from iServe? I would prefer not to, since producing a jar every time I make a slight change is not exactly efficient!
P.S: The second project is a regular GWT project with an entrypoint, not just a module. Should I remove this?
UPDATE: Trying to figure out the source of this error, I attempted to simplify the problem, so I performed the following moves:
I created two new simple GWT projects and tried to reference one
from the other. Worked fine
I referenced the project I actually want
to use (PetalsBPM) from the simple one I just created. Also works
fine.
I referenced the new simple project from the original one I
want to use (iServe). Also works fine.
Tried doing what I actually
want to do, copying the settings from 2&3. Produces the same error
"CreateProcess error=206, The filename or extension is too long" if
I reference PetalsBPM (does not when I remove it from the referenced
projects)
So, I tried switching workspaces. I created a new workspace in C:\, and moved the actual projects there. Still it did not work. :(
Any more ideas?
I met the same type of error "Create Process, error=206, path too long etc." a hundred times.
Then, I found a solution/explanation in google-groups, it solved my problem.
I post the content and link as it might help others.
This website (StackOverflow) really helped me a thousand times.
Thanks to you all !
solution/explanation :
(Response from Stephen Johnson)
(...) if you're using eclipse plugin go to Project | Properties, choose
Google \ App Engine \ ORM and only include directories that you have
classes that you want enhanced. By default it does the entire project
so that includes a lot of needless files. (...)
Link :
original post # google-groups
Read the exception message again. Somewhere along the way Maven is generating a path that is too long for (some) Windows API to handle, try moving your workspace to a directory straight below C:\.
I just tried "skolima" reply and it worked for me. In Eclipse I clicked File->Switch Workspace.
Three things to note:
After I created the workspace in "C:\workspace" I had to update my Project->Properties > Java Build Path > Libraries > Add External JARs...
I'm using Windows 7.
I'm using "Eclipse Java EE IDE for Web Developers"
I hope this others.

Location of config file for devmode in Eclipse?

I have a multi module GWT project (say a.gwt.xml, b.gwt.xml, c.gwt.xml) that I am building in eclipse and testing in devmode. All was working well until I deleted one of the gwt module file and associated source. Now when I try to launch devmode from eclipse it fails with the following error message.
Loading modules
com.fubar.b
[ERROR] Unable to find 'com/fubar/b.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
[ERROR] shell failed in doStartup method
I assume that this means there is a stale reference to the now defunct b.gwt.xml but I can't seem to find it in any of the config files. Any ideas?
At present I am working around this by doing a copy+rename a.gwt.xml -> b.gwt.xml (so there are effectively 2 copies of the a module names a + b) which works fine but compiles 2 copies of same module :(
What I think is your runtime configuration which is gone wrong. Individual projects should be fine. Open the runtime configuration which you were running and check the entries in GWT! If the module you have deleted still exists here, then you need to remove it.
Runtime config for project
You can refer to the following Video.
http://www.youtube.com/watch?v=UW4WSYs1bKE
To rename
Right Click on the project.
Select Run As ---> Run Configurations.
In the Arguments Tab, change the Old Module Names in Program
Arguments.
Also Make sure, in GWT Tab, Selected module name is correct.
ALREADY I HAVE ANSWERED THIS HERE : GWT:how can i rename my module