Is it possible to tell eclipse to add the following command line option:
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED
when compiling.
I think it may also be needed when running tests.
Is it also possible to remove this message:
Note that I tried to add those to the VM options of one of my unit tests but that did not work.
Go to Project > Properties: Java Build Path, tab Libraries
Select the JRE > Is modular node and click Edit...
Go to the tab Details
In the Added exports section click Add...
Enter the following:
Source module: jdk.compiler
Package: com.sun.tools.javac.tree
You can add the --add-exports jdk.compiler/.... options on VM Arguments as shown below.
Related
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
Just switch the IDE from Eclipse to intelliJ, when I use ctrl+q to try to pop up more explainations for the method, it shows no details like this. How can I fix it to get same information as Eclipse does?
This is because you didn't set Java source path in the project structure dialog.
Go to File > Project Structure and select SDKs from the left side. Then select your project JDK level (In your case it should be 1.8) and add JDK source path in Sourcepath tab.
Usually it should be named as src.zip and placed inside your JDK folder.
Trying to follow #Chathura Buddhika's answer I found I didn't have the jdk source installed:
$ file /usr/lib/jvm/java-8-openjdk-amd64/src.zip
/usr/lib/jvm/java-8-openjdk-amd64/src.zip: broken symbolic link to ../openjdk-8/src.zip
I installed the source package, restarted intellij, and then documentation "just worked". The Sourcepath got automatically added to the Project structure.
Debian/Ubuntu with open jdk8:
sudo apt-get install openjdk-8-source
Ref: https://stackoverflow.com/a/64340730/8954109
You can simply navigate to the class PrintStream where you can find the complete documentation by -
Right click on the method
Go to
Implementation
Select the class where you want to see its implementation
In this case PrintStream
(Shortcuts could vary as defined by users)
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
How do I enable partial compiles in IntelliJ?
The same feature in NetBeans where by one can run a main method in a class without having non-dependecies in the same project be required to also compile.
EDIT:
After performing what CrazyCoder suggested, with some success, now I get ClassNotFoundException when trying to run a file not associated with those that were not compiling. After fixing the non-compiling files, it runs just fine.
I actually made in error in the same non-compiling file to test and it still works.
Could it be a bug?
EDIT:
Followed instructions still not working.
IntelliJ IDEA doesn't welcome working on the project that fails to compile, but there are several options:
use Compile action from the file/folder context menu, disable Build in Run/Debug configuration.
in the Before launch section of the Run/Debug configuration remove Build and add Build, no error check instead. Now start the configuration and it will ignore compilation errors trying to run on whatever classes managed to compile.
You should note that Make will fail on the first error and will not try to proceed further. In this case you should use explicit Compile action. Make also deletes output class files for the sources with errors.
If you want compilation to proceed after errors, you should switch to Eclipse compiler in IntelliJ IDEA Settings | Compiler | Java Compiler. When Eclipse compiler is selected, Proceed on errors option appears and it's enabled by default. With Eclipse compiler, an option to Proceed on errors enabled and Build, no error check in Before launch section you should get the desired behavior.
Navigate to the Build menu at the bottom of your test editor, right-click on the folder that contains error messages that you find irrelevant.
Choose "Exclude from compile".
To make CrazyCoder comment more visible, if you go for the "proceed on errors" behavior you may want to uncheck
Settings | Compiler | Automatically show first error in editor.
I'm working with 2020.2.3 version of IntelliJ.
I've tried all CrazyCoder's suggestions, but nothing works for me.
Eclipse Compiler + Build No-Error-Check
IntelliJ just refuses to Run anything (unit tests, main() methods...) because errors exist in the project.
All I can say is that Eclipse is still working where IntelliJ remains blocked.
Step 1: Setting as follow:
Step2: Build Project Automatically
Step 3: Modify Run configuration
Step 4: close all app console-view tabs in Run View, then run app again Ctrl+Shift+F10
Recompile only selected files:
Select packages or files that needs to be compiled.
Menu → Build → Recompile selected files (⇧ ⌘ F9)
If you need to run or debug, you need to set Do not build before run:
Menu → Run → Edit Configurations...
☑︎ Your target run configuration
Run / Modify options → Java / ☑︎ Do not build before run
Another way of doing this is to set
Use classpath for module field
in Junit configuration tab in your test configurations as your own module. By default it is all_local_extensions.
Attached screenshots.
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.