I am new to JavaFX but I have already watched so much tutorials on YT how to do stuff and such, including connecting fontawesome to JavaFX project.
My icons appear properly in the scene builder, but when I launch the app - there are a lot of errors telling that probably library was not found(?).
SCENE BUILDER VERSION: 8.5 (because fontawesome icons dont work with higher versions)
Java SDK: 11
Fontawesome version: 8.9
I tried to connect jar file as a global library in the project's structure - is this a correct way to do that?
This is the error (actually the most valuable part of it)
"C:\Program Files\Java\jdk-11.0.2\bin\java.exe" --add-modules javafx.base,javafx.graphics --add-reads javafx.base=ALL-UNNAMED --add-reads javafx.graphics=ALL-UNNAMED "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2019.1\lib\idea_rt.jar=63160:C:\Program Files\JetBrains\IntelliJ IDEA 2019.1\bin" -Dfile.encoding=UTF-8 -p "C:\Program Files\Java\javafx-sdk-11.0.2\lib\javafx.base.jar;C:\Program Files\Java\javafx-sdk-11.0.2\lib\javafx.graphics.jar;C:\Users\ekoal\Documents\Aplikacja\DigitalSchoolDiary\out\production\DigitalSchoolDiary;C:\Program Files\Java\javafx-sdk-11.0.2\lib\javafx-swt.jar;C:\Program Files\Java\javafx-sdk-11.0.2\lib\javafx.controls.jar;C:\Program Files\Java\javafx-sdk-11.0.2\lib\javafx.fxml.jar;C:\Program Files\Java\javafx-sdk-11.0.2\lib\javafx.media.jar;C:\Program Files\Java\javafx-sdk-11.0.2\lib\javafx.swing.jar;C:\Program Files\Java\javafx-sdk-11.0.2\lib\javafx.web.jar;C:\Users\ekoal\Downloads\fontawesomefx-8.9.jar;C:\Users\ekoal\Documents\Aplikacja\DigitalSchoolDiary\lib\jfoenix-9.0.8.jar" -m DigitalSchoolDiary/main.Launch
Exception in Application start method
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:464)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:363)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at java.base/sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:1051)
Caused by: java.lang.RuntimeException: Exception in Application start method
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:900)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:195)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: javafx.fxml.LoadException:
/C:/Users/ekoal/Documents/Aplikacja/DigitalSchoolDiary/out/production/DigitalSchoolDiary/views/LoginUI.fxml
at javafx.fxml/javafx.fxml.FXMLLoader.constructLoadException(FXMLLoader.java:2625)
at javafx.fxml/javafx.fxml.FXMLLoader.importClass(FXMLLoader.java:2863)
at javafx.fxml/javafx.fxml.FXMLLoader.processImport(FXMLLoader.java:2707)
at javafx.fxml/javafx.fxml.FXMLLoader.processProcessingInstruction(FXMLLoader.java:2676)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2542)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2466)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3237)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3194)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3163)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3136)
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:3113)
at javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:3106)
at DigitalSchoolDiary/main.Launch.start(Launch.java:22)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
... 1 more
Caused by: java.lang.ClassNotFoundException: de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
at javafx.fxml/javafx.fxml.FXMLLoader.loadTypeForPackage(FXMLLoader.java:2931)
at javafx.fxml/javafx.fxml.FXMLLoader.loadType(FXMLLoader.java:2920)
at javafx.fxml/javafx.fxml.FXMLLoader.importClass(FXMLLoader.java:2861)
... 20 more
Exception running application main.Launch
Process finished with exit code 1
And this is my fxml import part of the font awesome:
<?import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView?>
EDIT:
IML file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="JavaFX11" level="application" />
<orderEntry type="library" name="javaFX11" level="application" />
<orderEntry type="library" name="fontawesomefx-8.9" level="project" />
<orderEntry type="library" name="JFoenix-9.0.8" level="project" />
</component>
</module>
I am not sure if this is what you were asking about - because I have read a lot about dependencies right now and it seems like the more I read about it, the more confused I am.
I have added JAR file to the project's libraries folder in the modules section.
Also I found post on other site where guy had a similar problem and at the end he said: "I fixed the issue by just updating my jfoenix to version 9.0.6 from 8.0.7"
Unfortunately it didn't worked for me.
Could you tell me please - am I connecting this library in a right way?
I am using JDK.12.0.1 and it works good for me but you should add a JAR file from this website. Add it to your current project.
You have to modify also your module-info.java with requires fontawesomefx.
I hope that will helps you.
Related
In similar questions I could not find a sufficient answer. I followed the IntelliJ tutorial for Groovy, but it did solve the solution. Finally I solved it via a 1A4 Maven file.
For getting started more easy, maybe you could help me and others with Groovy in IntelliJ.
What did I do:
I installed the Groovy SDK
I started IntelliJ, created a new Groovy project and I could see the library was added.
After creating my first Groovy class, a compile error mentioned:
Error: Cannot compile Groovy files: no Groovy library is defined
I double checked that the library is there. And I also added the library to the module via the File > project structure > libraries. I get this result:
Added on request: I added project structure > modules > dependencies:
How your .iml file looks like?
I repeated all steps from your message and have successfully run GroovyDemo.groovy class without any errors.
My .iml file is:
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="groovy-2.4.15" level="application" />
</component>
</module>
Make sure what you have groovy library inside. If you don't have it, you need to open project setting and add it manually into Libraries or Global Libraries.
I'm using IDEA 2018.1.6 UE. What is your version?
EDIT 1:
I finally reproduce your error.
I delete .idea folder from my project scope;
I open old project and it recreate the whole structure;
After that I see the same error when trying to run groovy class
I fix it by manually add groovy library to the project dependencies.
ctrl+shift+alt+s.place in Project Structure.then setting your Libraries,attending to your groovy install-file-folder lib--> groovy-***.jar。
I am in IntelliJ IDEA 2017.1.2. I recently renamed a module from mod_plus to exp-packs and now I keep getting the error:
Error Loading Project: Cannot load module mod_plus
The old module does not exist. Under File-> Project Structure->Modules->Dependencies it does not show up, it was there, but I removed it when I first saw the error. It does not show up in the .iml file:
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="Pyhton-Snippets" />
<orderEntry type="module" module-name="exp_packs" />
</component>
</module>
In the event log, when I click 'Details' and it asks do I want to remove, I click YES and it is gone for that session, but on restart it comes back. Any thoughts on how to get rid of it?
IntelliJ IDEA loads modules according to .idea/modules.xml file which contains the relative paths to the .iml files.
If you rename a module in IntelliJ IDEA using refactoring, modules.xml file is updated automatically. In other cases you may need to update the path manually.
We have 3 weblogic extension templates jars A,B and C. We have created another template jar D which deploys all the three templates by specifying their names under dependency tag in template-info.xml as shown below.
template-info.xml
<dependency>
<and>
<requires name="A" version="11.1.1.0" colocated="false" />
<requires name="B" version="11.1.1.0" colocated="false" />
<requires name="C" version="11.1.1.0" colocated="false" />
</and>
</dependency>
If D template is applied for a new empty domain with addTemplate it deploys all the templates successfully. But the same template fails for custom domain(domain with managed server and few data sources) with the below error message. Please help.
wls:/offline/CustomDomain>addTemplate('/scratch/D.jar')
Error: addTemplate() failed. Do dumpStack() to see details.
wls:/offline/CustomDomain>wls:/offline/CustomDomain>dumpStack()
com.oracle.cie.domain.script.jython.WLSTException: com.oracle.cie.domain.script.ScriptException: com.oracle.cie.domain.template.dependency.UndeterministicSelectionException: One of the following needs to be selected:
A - 11.1.1.0 [som]
A - 11.1.1.0 [som]One of the following needs to be selected:
B - 11.1.1.0 [som]
B - 11.1.1.0 [som]One of the following needs to be selected:
C - 11.1.1.0 [som]
C - 11.1.1.0 [som]
at com.oracle.cie.domain.script.jython.CommandExceptionHandler.handleException(CommandExceptionHandler.java:51)
at com.oracle.cie.domain.script.jython.WLScriptContext.handleException(WLScriptContext.java:1538)
at com.oracle.cie.domain.script.jython.WLScriptContext.addTemplate(WLScriptContext.java:420)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
Why am I getting 2 duplicate names? Have I missed any configuration? How to fix this issue?
I am using TomEE to deploy an EAR file, that contains one EJB JAR and one WAR.
I want to add entities using the default provider. I have created a resource in tomee.xml to use MySQL DB.
Then I would like to use entity manager so I am trying to create the following persistence.xml in the EJB JAR META-INF directory:
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
<persistence-unit name="MyProjectDataBase" transaction-type="JTA">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<jta-data-source>MyProjectDS</jta-data-source>
<non-jta-data-source>MyProjectDSUnmanaged</non-jta-data-source>
<properties>
<property name="openjpa.jdbc.DBDictionary" value="mysql" />
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema" />
</properties>
</persistence-unit>
</persistence>
MyProject & MyProjectUnmanaged are the resources Ids I created in tomee.xml.
Once I add this persistence.xml I get the following exception in catalina.out and my app is not deployed:
SEVERE: Application could not be deployed: /Users/avitale/Development/apache-tomee-jaxrs-1.5.0/apps/projecteam-ear
org.apache.openejb.OpenEJBException: Creating application failed: /Users/avitale/Development/apache-tomee-jaxrs-1.5.0/apps/projecteam-ear: loader (instance of org/apache/catalina/loader/StandardClassLoader): attempted duplicate class definition for name: "org/apache/openejb/cdi/CdiPlugin"
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:940)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:532)
at org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:433)
at org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:341)
at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:144)
at org.apache.openejb.OpenEJB.init(OpenEJB.java:290)
at org.apache.tomee.catalina.TomcatLoader.initialize(TomcatLoader.java:231)
at org.apache.tomee.catalina.TomcatLoader.init(TomcatLoader.java:131)
at org.apache.tomee.catalina.ServerListener.lifecycleEvent(ServerListener.java:113)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:401)
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:110)
at org.apache.catalina.startup.Catalina.load(Catalina.java:633)
at org.apache.catalina.startup.Catalina.load(Catalina.java:658)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:281)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:450)
Caused by: java.lang.LinkageError: loader (instance of org/apache/catalina/loader/StandardClassLoader): attempted duplicate class definition for name: "org/apache/openejb/cdi/CdiPlugin"
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:295)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at org.apache.openejb.cdi.OptimizedLoaderService.loadWebBeansPlugins(OptimizedLoaderService.java:70)
at org.apache.openejb.cdi.OptimizedLoaderService.load(OptimizedLoaderService.java:53)
at org.apache.openejb.cdi.OptimizedLoaderService.load(OptimizedLoaderService.java:47)
at org.apache.webbeans.plugins.PluginLoader.startUp(PluginLoader.java:75)
at org.apache.openejb.cdi.OpenEJBLifecycle.startApplication(OpenEJBLifecycle.java:159)
at org.apache.openejb.cdi.ThreadSingletonServiceImpl.initialize(ThreadSingletonServiceImpl.java:150)
at org.apache.openejb.cdi.CdiBuilder.build(CdiBuilder.java:44)
at org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:794)
... 20 more
Once I remove the persistence.xml then the application is successfully deployed.
Please help me as I don't understand how to proceed :(
Thanks in advance.
Would be helpful if you could specify the version you are actually using.
More over, did you check you won't deliver TomEE or any related dependencies in your EAR file (I mean lib/ or WEB-INF/lib)?
For your information, TomEE 1.5.1 will be released shortly with some fixes around EAR deployments.
I have a project using forms, it compiles and runs just fine,
but when compiled with the generated ant it doesn't run
my ant file has the java2 task and i added the needed jars to my lib folder
<property name="javac2.home" value="lib/idea"/>
<path id="javac2.classpath">
<pathelement location="${javac2.home}/javac2.jar"/>
<pathelement location="${javac2.home}/jdom.jar"/>
<pathelement location="${javac2.home}/asm.jar"/>
<pathelement location="${javac2.home}/asm-commons.jar"/>
<pathelement location="${javac2.home}/jgoodies-forms.jar"/>
</path>
<taskdef name="javac2" classname="com.intellij.ant.Javac2" classpathref="javac2.classpath"/>
<taskdef name="instrumentIdeaExtensions" classname="com.intellij.ant.InstrumentIdeaExtensions" classpathref="javac2.classpath"/>
but when I run my program I get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: com/intellij/uiDesigner/core/Spacer
Caused by: java.lang.ClassNotFoundException: com.intellij.uiDesigner.core.Spacer
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
I have noticed that the version compiled from the Idea has some classes in the output folder (what is missing) while the ant generated version doesn't have those classes.
EDIT: i implemented the solution from below, this means I modified my ant build to extract the content of forms_rt.jar to my output folder
<unjar src="${javac2.home}/forms_rt.jar" dest="${webserver.output.dir}">
<patternset>
<include name="**/*.class"/>
</patternset>
</unjar>
You need to include forms_rt.jar from IDEA_HOME\redist into the classpath of your application, either via manifest or by unpacking the classes from this jar and packaging them together with the final jar of your application.
When you compile from IDEA, it copies the required classes to the output automatically (it's controlled via an option in Settings | GUI Designer).