How to run javafx applications in intellij idea IDE - java

I am trying to run JavaFX application but there is showing the following error
Error: JavaFX runtime components are missing, and are required to run this application
Until this step, I could not import the JavaFX, and I have done it from /usr/lib/jvm/java-8-openjdk-amd64
Can someone help to solve this error?
Thanks beforehand.
By the way, I am using lubuntu operating system
extra information

As explained on official OpenJFX website
open your intellij idea IDE and create new Project
Go to File > Project Structure
Go to Project Settings > Libraries
Click on + button
Locate ..\openjfx-11.0.1_windows-x64_bin-sdk\javafx-sdk-11.0.1\lib folder from extracted zip of openJFX 11
Apply settings and click ok
Go to File > Settings
In Settings go to Appearance & Behavior > System Settings > Path Variables
Click on + and add new path variable name it PATH_TO_FX and in value field locate ..\openjfx-11.0.1_windows-x64_bin-sdk\javafx-sdk-11.0.1\lib folder
Apply settings and click ok
The go to Run > Edit Configurations
Select your Application from Application > {your application name}
Then click on Configuration tab and in VM options field write this:
--module-path ${PATH_TO_FX} --add-modules=javafx.controls,javafx.fxml
Then Click on
Edit templates button select Application in Templates and again in VM options field write this:
--module-path ${PATH_TO_FX} --add-modules=javafx.controls,javafx.fxml
Apply settings and click ok and now you are good to go
You have to do this whenever you create new project in intellij

There is no strictly defined javafx in openjdk8.
You need to install openjfx via commandline:
sudo apt-get install openjfx

Related

How to update already installed IntelliJ IDEA on Ubuntu?

Currently, I have IntelliJ IDEA 2016.3 installed in my Ubuntu 16.04 for Java programming. I have installed it through the IntelliJ website and not the ppa. Upon launching it, I get an update available notification on bottom right corner and upon clicking update, it opens the IntelliJ IDEA webpage for downloading the latest IDE tar file. I know that in order to install it, I need to download the tar file, untar it inusr/local, and run idea.sh from the bin folder. Even after doing that, when I search for IntelliJ in the Unity Dash, I see the icon for the old 2016.3 version and upon clicking it, it opens the same old version.
So my question is, how can I update the entire existing IntelliJ platform and see it as the result upon search in the Unity Dash? Can I update it in the same way in which I can update the existing plug-ins and see them in effect upon restarting IntelliJ?
I recommend using Toolbox App for the seamless automatic updates.
If you have upgraded manually, use the Tools | Create Command-line Launcher and Create Desktop Entry to update the old ones.
I also suggest to use ToolBox but in case it is not an option, I just upgraded from IntelliJ 173 to 181 in Ubuntu 16.04 manually and I did it like this.
Download the new IntelliJ version's .tar.gz file from Jetbrains
website
Untar the file and put all of its content to the desired location. I put mine in /opt folder for example: sudo tar -zxf ideaIU-2018.1.tar.gz -C /opt
Go inside the new IntelliJ's folder and run the idea.sh script. Example:
cd /opt/idea-IU-181.4203.550/bin then ./idea.sh and follow the instructions (select the option to import your settings from your previous Idea's version).
At this moment you have two versions installed but you run the old one when clicking on the Idea icon from the launcher. The problem is that the file (with extension .desktop) that sets up the launcher's icon still points to your old version. You can change that.
The desktop file may be in ~/.local/share/application or /usr/share/applications. Mine was in ~/.local/share/application and its name was jetbrains-idea.desktop.
Edit jetbrains-idea.desktop file with your favorite editor and change the values that need to be changed. In my case I only had to change the values of "Icon" and "Exec" properties. Check the real path from your IntelliJ's installation folder (what we did in point 2 above). Example below of my modified .desktop file:
[Desktop Entry]
Version=1.0
Type=Application
Name=IntelliJ IDEA Ultimate Edition
Icon=/opt/idea-IU-181.4203.550/bin/idea.png
Exec="/opt/idea-IU-181.4203.550/bin/idea.sh" %f
Comment=The Drive to Develop
Categories=Development;IDE;
Terminal=false
StartupWMClass=jetbrains-idea
Save the file and check that its syntax with the command desktop-file-validate pathOfYour.desktopFile (no output means all is fine).
Update your system with the latest changes for .desktop files: sudo update-desktop-database.
Check that the icon from the launcher now launches the new version of IntelliJ. If it does not, log off and log on from Ubuntu. That should do.
You can delete the directory of your previous IntelliJ's version + its hidden directory in your home folder.
You may want to update the values of the executable file /usr/local/bin/idea (if it exists) to point to your new version.
In case anyone still needs an optional solution.
First of all, just install the new version IntelliJ as the first three steps of #Stephane B.'s solution
Download the new IntelliJ version's .tar.gz file from Jetbrains website
Untar the file and put all of its content to the desired location. I put mine in /opt folder for example: sudo tar -zxf ideaIU-2018.1.tar.gz -C /opt
Go inside the new IntelliJ's folder and run the idea.sh script. Example: cd /opt/idea-IU-181.4203.550/bin then ./idea.sh and follow the instructions (select the option to import your settings from your previous Idea's version).
At this moment you have two versions installed but you run the old one when clicking on the Idea icon from the launcher.
To start the new version intelliJ from the launcher:
In the new version IntelliJ, click Configure -> Create Desktop Entry. Now you can start new version from the launcher.
(Optional) You may want to delete the old one. sudo rm -rf /opt/idea-xxx-old-version-xxx
If you are an admin on your system, you are usually in the sudo group
# This will change the group of Intellij folder, subfolders and files to a
# likely existing admin group `sudo` that you will likely be apart of as an admin.
sudo chgrp -R sudo /opt/intellij-idea-community
# Add `+` `w`rite permission for `g`roup for the Intellij folder, subfolders and files
sudo chmod -R g+w /opt/intellij-idea-community
Now you should be able to run the update from the UI (Tested successfully on Ubuntu 14.04).

How do I tell IntelliJ about groovy installed with brew on OSX

I'm running:
IntelliJ Ultimate 2016.3
Homebrew 1.1.2
OS X 10.11.5 El Capitan
I ran brew install groovy which resulted in groovy being installed in /usr/local/Cellar/groovy/2.4.7/. Brew also added a symlink: /usr/local/bin/groovy -> ../Cellar/groovy/2.4.7/bin/groovy
When I open the groovy project in IntelliJ, it gives me an option to Configure a Groovy SDK. I haven't set this up yet, so I get a "Create" button, which launches finder. From what I can tell there's nothing that I can select to make IntelliJ happy. I've tried /user/local/bin/groovy, /user/local/Cellar/groovy, /user/local/Cellar/groovy/2.4.7, /user/local/Cellar/groovy/2.4.7/bin etc. No mater which I choose, IntelliJ doesn't accept the library and continues to tell me "Error: library is not specified".
Does anyone know how I'm supposed to go about telling IntelliJ where groovy is?
Install groovysdk:
brew remove groovy
brew install groovysdk
Set GROOVY_HOME, otherwise Intellij reports as broken installation:
export GROOVY_HOME=/usr/local/opt/groovy/libexec
Point IntelliJ to the installed directory, e.g.:
/usr/local/Cellar/groovysdk/2.4.7/libexec
brew install groovysdk
Right-Click on Project Root Folder or if a Config Wizard Pops up at the top of your windows we can click that link.
Select Add Project Framework Support
Scroll down and select Groovy
If it does not show in the list; it's because it already has the framework added.
If Groovy has not been added to IntellJ then Select Create...
browse /usr/local/Cellar/groovysdk//libexec/ e.g: /usr/local/Cellar/groovysdk/2.4.11/libexec/
Gotcha - It does show file browser that does not let you view your /usr/local file path, you need to press shift + command + g will open a dialog where you can type the path of any folder that you want to open
Done.
/usr/local/opt/groovy/libexec.
use brew info groovy to print help:
==> Caveats
You should set GROOVY_HOME:
export GROOVY_HOME=/usr/local/opt/groovy/libexec
I did this with Intellij IDEA 2016.3 on OS X.
I am able to configure this under Project Settings -> Global Libraries.
Add a new global library by clicking the + and select Java
Navigate to the location homebrew installed Groovy, /usr/local/Cellar/groovy/2.4.7 and select all the JAR files in the libexec/lib directory.
Set the name to groovy-2.4.7, or whatever works for you.
It is very easy to do:
Install groovy:
brew install groovy
Point IntelliJ to the following directory:
/usr/local/Cellar/groovysdk/<version>/libexec
You will see that intellij will get all the required dependencies
Because I could not select /usr in the open dialog, I used to 'go to folder' function of finder and created a favorite entry for /usr/local/opt/groovy/libexec
which worked.

Specified VM install not found: type Standard VM, name jre7

Specified VM install not found: type Standard VM, name jre7
Have you ever encountered this problem in Eclipse while building an ant file? Then this article is for you. Deleting and recreating the workspace is not the solution. There is an easy solution to fix this issue without recreating the workspace.
Right Click on build.xml
Go to "Run As" >> "External Tools Configurations..."
It shall open new window
Go to JRE tab
Select proper JRE if missing (sometimes jre tabs shows error mark on that.)
For more technical details or issue similar to this find my blog here.
In my case it happen as I have changed my JRE.
Solution :
Right click on your ant script > Run as > External tool configurations... > Go to JRE tab > select JRE
Hope this help.
Thanks,
Sagar Vyas
Best answer found at
It happened for me after Un-installing Java and installing new version.
All I have to do is in eclipse open Installed JREs from
Windows --> Preferences --> Java --> Installed JREs
Then Add new JRE information. Details can be found here
This is a preferred way tell projects which JDK container to use, especially true if two or more devs are using the same version controlled eclipse project folder.
Window/Preferences/Java/Installed JREs
List one or more JDKs installed on your computer. Eclipse defaults name to jdk1.X.X_XX you should keep it as is. Never link project build settings directly to use these names.
Window/Preferences/Java/Installed JREs/Execution Environments
List of common jvm environments such as JavaSE-1.6 and JavaSE-1-7 names. Click rows and choose jre instance on the right side panel. These names are common and all team members should already have them in Eclipse installation.
Step 1: This is where you may accidentally have nothing chosen if JREs were uninstalled or names changed in InstalledJREs setting. You may get
Specified vm install not found error dialog.
Step 2: Choose 2nd mouse on build.xml file/Run As/Ant Build... popup menu entry. Click on JRE tab and choose execution environment. This may have obsolete value from the previous jdk values.
Project Properties/Java Build Path/Libraries
Add Library.../JRE System Library/(x)Execution environment
Choose execution environment to be used for this project. Team members may not have exact _XX jdk build but they can use the same version controlled eclipse project settings. Execution environment mapping hides user specific details.
Just had this issue & the solution above does not work, atleast not for me.
Instead I went the solution provided here:http://www.javaworkspace.com/VMNotFound.do
Essentially you go to the directory C:\projects\WORKSPACE.metadata.plugins\org.eclipse.debug.core.launches
In there search for the string of the JDK that that eclipse is moaining about & change it to the name of your installed JDK that you want to use that eclipse knows about.
You can change what JRE the ant bulid file is launched with inside eclipse.
Right click on the ant file in the ant view and select "Run As"->"Ant..." from the context menu.
Then in the launch dialog select the JRE tab. Note the error message at the top if it can't find the JRE that it expects.
Select a JRE that you have installed or manage install a new one. You can also add vm arguments (enable logging or change memory alocation) if you need to in this dialog.
Just delete the below file
"<Your eclipse workspace location>\.metadata\.plugins\org.eclipse.debug.core\.launches\<projectname>.xml.launch"
link to post
The last answer is absolutely correct, however a fast track way is to delete the project reference from eclipse (make sure to keep unchecked delete source) and import your project folder again. This way the project configurations are reset by eclipse using the new jdk.
But a wonderful post it did help me.
After Java update ant build failed and the below steps fixed it .
Right Click on build.xml-Run As-External Tools
Go to JRE tab and check the box to use the JRE same as workspace.
Removed below file and build maven project again, worked for me.
.metadata.plugins\org.eclipse.debug.core.launches\.xml.launch"
(ant file)Run As--> External Tool Configuations,
go to JRE tab and choose JRE

specified JRE installation does not exist

I'm trying to launch a server on my tomcat 7 on my eclipse indigo EE
and I get the following error:
"'starting Tomcat v7.0 server at localhost' has encountered a problem.
The specified JRE installation does not exist"
I checked the build path configuration and on the libraries section I have the
JDK7 as JRE System Libraray and when I check "Installed JREs..." the correct
path is there - "C:\Program Files\Java\jdk1.7.0_01".
What else can be done? Many thanks.
p.s. - I'm also using maven 3.0.3
Double click on the server to bring up the Overview.
Click on Runtime Environment.
Select the JRE from the dropdown list. You may need to set this up by clicking on Installed JREs and clicking Add.
If the instructions above did not help you can do the following:
1- from the run menu choose "Run configurations..."
2- Choose your maven run profile and then click on the "JRE" tab.
3- Select "Alternate JRE" and from the drop down select "jdk1.7xxx" (or whatever jdk you want to use"
you can also select the workspace default jre.
I was facing the same problem and this helped.
Go to the build file.
Right click on it.
Do the following as per the screenshots
Window-->Prefenerces-->Server-->Runtime Environment; like this....
Edit your Apache,and select your jdk dir....
Go to Properties → Java Build Path → Libraries.
Here you will see a red cross on the library whose path is not correct.
Select this library, click the Edit button, and change it to the correct path.
Here is a solution with pictures
http://javahonk.com/specified-jre-installation-does-not-exist/
It worked after running "mvn install clean -P prepare"
For Eclipse MARS, for maven projects.
After you install the new JRE as explained (for instance here: http://javahonk.com/specified-jre-installation-does-not-exist/), don't use your old configuration, BUT create a new configuration.
Updated the Java , JRE. so I have faced this same issue, I have tried all this but i continued with this issue. then after that, i have removed the server from application and then added new server and with that i have mentioned new JRE version now its working fine.
Open eclipse and find the server tab and try to open it.
There click on Runtime Environment
Select the JRE from the dropdown list to set this up by clicking Installed JREs and Add.
If you use Maven, try:
EclipseMavenJRE_1
EclipseMavenJRE_2
Window-->Prefenerces-->Server-->Runtime Environment;
like this....
enter image description here
Edit your Apache,and select your jdk dir....
It worked after updating Server Runtime environment JRE .
At my case, I've changed the JRE installed at Eclipse and still the messages came out.
So,
1 - Right click at the JBoss Server > Open Lauch Configuration
2 - Select tab Classpath and click "Restore Default Entries"
3 - Close the window and Right click again the Jboss Server
4 - Select Properties > General
5 - Click two times 'Switch Location' (it returns to [workspace
metadata])
6 - Click Apply and Close
Afterwards, a new right click at Jboss Server > Clean, and the Jboss Server stopped the message.
Hope it helps.

Eclipse Debug: Source Not Found while remote debugging

In my Java eclipse project, while I am remote debugging, eclipse does not step into the class files of imported library files even though the source file jars are properly mapped to the library files.
Instead it gives me a "Source Not Found" error. But when I am editing the same class in eclipse, I can control-click a class or method name and it takes me to the correct library class file.
Can anyone please tell me what I am doing wrong?
I am using Tomcat 6 and latest Eclipse Java EE.
In this scenario just follow the following steps:
Go to Run → Debug Configurations
Select the remote application configuration being debugged.
Select the second tab named 'Source'
Now add the folder/projects containing the source code explicitly here.
In the Java build path for the project, under the sources tab, check if your class path is under the included list. If its under the excluded list, remove it from there.
As Saury said, get your debug configuration right. When remote debugging, often developers have selected the wrong project while creating a new configuration. Verify you select the project you wish to debug and it corresponds to the version of the deployed WAR/EAR/JAR in the appliation container.
I faced same issue and got solved by below steps in eclipse.
Go to Severs tab in your Eclipse tab
Right click on the server and click on Add and Remove Projects
Select/add the project EAR which you want to debug
After finish - Start your server in debug mode
Should solve with above steps as it resolved for me:)
I ran into a similar problem. It turns out I was missing the devel package on CentOS.
In my particular case, the following yum statement solved the problem.
yum install java-1.7.0-openjdk-devel
Follow the next steps in case you use a parent project connected to sub-project/s:
Use the 'Debug Cofigurations' source tab or the 'Edit Source LookUp path' option to attach the sources of the running code.
Note: you'll need to attach the src folder of your inner project rather than the target in order to make it work (check the screenshot below).
E.g.
An update for eclipse Oxygen (Feb 2018):
Attaching the Java projects (sub projects) also worked well; e.g:
Check under "Debug Configurations" -> "Remote Java Application" -> Tab "Connect" -> "Project" that you chose the correct project.
Here is how it worked for me. Did this on Eclipse oxygen
Go to debug configurations and then the source tab
Click on Add
Select Java Library. Hit ok
The select Web app libraries and click next
In the next screen select the project/application that you are
debugging.
Click Finish
This worked for me like a charm
Using Eclipse version Oxygen.2 (2017), the accepted answer did not work for me. The following procedure was successful.
Launch the application to debug with the Xdebug and Xrunjdwp switches.
cd "C:\Program Files\Test_742\Test 7.4"
test_app.exe -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8500
Create a new workspace in Eclipse.
Create a new Java project using File -> New -> Java Project.
Copy the source code of the Jar to debug to the src folder of the new project. I found it necessary to ensure that I copied the complete folder hierarchy of the source code to my source folder.
For me that meant copying \com\test... to my src folder.
This puts all the source code in the build path.
Copy any dependency JARs to the project. I created a new folder named myJARs.
Refresh Package Explorer to see the new myJARs folder.
Add the dependency JARs to the build path by opening File -> Properties -> Java Build Path -> Libraries (tab), and click Add JARs...
Add each dependency JAR to the list, then click Apply and Close. This adds the JARs to Referenced Libraries.
Configure a debug session. Click Run -> Debug Configurations -> Remote Java Application. I set Connection Type = Standard.
Configure Host to point to the machine running the JAR and Port to the port specified in the address portion of the command line switches (8500 in my example).
Notice that on the Source tab, both the source files and the dependency JARs are present.
Click Apply, then Debug.
View the debugging perspective by clicking Window -> Perspective -> Open Perspective -> Debug.
Place breakpoints in the source code.

Categories

Resources