Eclipse - Unable to install breakpoint in a Java API Class - java

I have found a few question about the issue here on StackOverlow, but all were about own written code. My problem is a bit different, because I want to debug a Java API class, named javax.swing.JComponent.
My first problem was, that I couldn't see any sources. I fixed it described like here Attach the Java Source Code by attaching the source to rt.jar.
Now I see the source and I want to set a breakpoint in the JComponent class. If I try so, I get the error message:
"Modify compiler options to generate line number attributes". That is a nice proposal. But my JDK version was already compiled when I downloaded it..
So, do I have it to compile on my own? Or do you have other advices?
Thanks for your help!
P.S.: I have installed
- Eclipse Neon
- jdk1.8.0_91
- Windows 10 (64 Bit)

One probable issue could come from your application server in IDE pointing to JRE instead of JDK.
Try verifying:
Window -> Preferences --> Server --> runtime environments
<Your-Application-Server> --> edit
Select a JDK instead of JRE
Not sure if you have gone through this link.... has few solutions which worked for some.
Eclipse - Unable to install breakpoint due to missing line number attributes

this happens when you use JRE on your build path in this case.
Try do this:
Window -> Preferences --> Java --> Installed JRES-->then use jdk as default JRE
problem fixed!

Related

With java 9 ea, Eclipse fails to install and show error "An error has occurred, see the log file null"

I know this problem occurs many time, but I have find a similar situation like I have.
Every time I click the Eclipse Installer, I will get a prompt:An error has occurred, see the log file null. I can't even install Eclipse.
I guess the problem is due to "JDK 9-ea", so I am planing to uninstall jdk 9-ea and use jdk8, but maybe you can help me to solve this problem directly, thanks !
First, you need to get the correct install most probably, here is the Oxygen 4.7 M6 link : http://download.eclipse.org/eclipse/downloads/drops4/S-4.7M6-201703082000/
Or the direct link to the .tar.gz
Then (after you untar the archive), go to :
Eclipse.app/Contents/Eclipse/eclipse.ini
and add one parameter after -vmargs. It should look like this:
-vmargs
--add-modules=java.se.ee
This will allow you to start the Eclipse under jdk-9.
In case you want to install the jdk-9 plugin (so that you could compile code under jdk-9): you need to install the Experimental Plugin for jdk-9. There were some problems with that (I filed a bug that was closed), see this thread. At the end there is the link for on how to get the plugin.
Then you need to follow the exact instructions here for it to actually work.
Simply adding this line to the eclipse.ini "--add-modules=java.se.ee" will resolve the whole issue
mine is macOs and Java 9 installed alone without any other version
Hope this helps

Class JavaLaunchHelper is implemented in two places

Today I upgraded my Intellij Idea on macOS Sierra, and now, when I run apps in console I have this error:
objc[3648]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/bin/java (0x10d19c4c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x10ea194e0). One of the two will be used. Which one is undefined.
You can find all the details here:
IDEA-170117 "objc: Class JavaLaunchHelper is implemented in both ..." warning in Run consoles
It's the old bug in Java on Mac that got triggered by the Java Agent being used by the IDE when starting the app. This message is harmless and is safe to ignore. Oracle developer's comment:
The message is benign, there is no negative impact from this problem
since both copies of that class are identical (compiled from the exact
same source). It is purely a cosmetic issue.
The problem is fixed in Java 9 and in Java 8 update 152.
If it annoys you or affects your apps in any way (it shouldn't), the workaround for IntelliJ IDEA is to disable idea_rt launcher agent by adding idea.no.launcher=true into idea.properties (Help | Edit Custom Properties...). The workaround will take effect on the next restart of the IDE.
I don't recommend disabling IntelliJ IDEA launcher agent, though. It's used for such features as graceful shutdown (Exit button), thread dumps, workarounds a problem with too long command line exceeding OS limits, etc. Losing these features just for the sake of hiding the harmless message is probably not worth it, but it's up to you.
Since “this message is harmless”(see the #CrazyCoder's answer), a simple and safe workaround is that you can fold this buzzing message in console by IntelliJ IDEA settings:
【Preferences】- 【Editor】-【General】-【Console】- 【Fold console lines that contain】
Of course, you can use 【Find Action...】(cmd+shift+A on mac) and type Fold console lines that contain so as to navigate more effectively.
add Class JavaLaunchHelper is implemented in both
On my computer, It turns out: (LGTM :b )
And you can unfold the message to check it again:
PS:
As of October 2017, this issue is now resolved in jdk1.9/jdk1.8.152/jdk1.7.161
for more info, see the #muttonUp's answer)
I am using Intellij Idea 2017 and I got into the same problem. What solved the problem for me was to simply
close the project in intelliJ
File -> New -> project from existing resources
use Import from external model (if any)
open the project again.
This happened to me when I installed Intellij IDEA 2017, go to menu Preferences -> Build, Execution, Deployment -> Debugger and disable the option: "Force Classic VM for JDK 1.3.x and earlier". This works to me.
I have found the other workaround: to exclude libinstrument.dylib from project path. To do so, go to the Preferences -> Build, Execution and Deployment -> Compiler -> Excludes -> + and here add file by the path in error message.
Same error, I upgrade my Junit and resolve it
org.junit.jupiter:junit-jupiter-api:5.0.0-M6
to
org.junit.jupiter:junit-jupiter-api:5.0.0
This was an issue for me years ago and I'd previously fixed it in Eclipse by excluding 1.7 from my projects, but it became an issue again for IntelliJ, which I recently installed. I fixed it by:
Uninstalling the JDK:
cd /Library/Java/JavaVirtualMachines
sudo rm -rf jdk1.8.0_45.jdk
(I had jdk1.8.0_45.jdk installed; obviously you should uninstall whichever java version is listed in that folder. The offending files are located in that folder and should be deleted.)
Downloading and installing JDK 9.
Note that the next time you create a new project, or open an existing project, you will need to set the project SDK to point to the new JDK install. You also may still see this bug or have it creep back if you have JDK 1.7 installed in your JavaVirtualMachines folder (which is what I believe happened to me).

Class JavaLaunchHelper is implemented in both XXX and XXX,One of the two will be used. Which one is undefined [duplicate]

Today I upgraded my Intellij Idea on macOS Sierra, and now, when I run apps in console I have this error:
objc[3648]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/bin/java (0x10d19c4c0) and /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents/Home/jre/lib/libinstrument.dylib (0x10ea194e0). One of the two will be used. Which one is undefined.
You can find all the details here:
IDEA-170117 "objc: Class JavaLaunchHelper is implemented in both ..." warning in Run consoles
It's the old bug in Java on Mac that got triggered by the Java Agent being used by the IDE when starting the app. This message is harmless and is safe to ignore. Oracle developer's comment:
The message is benign, there is no negative impact from this problem
since both copies of that class are identical (compiled from the exact
same source). It is purely a cosmetic issue.
The problem is fixed in Java 9 and in Java 8 update 152.
If it annoys you or affects your apps in any way (it shouldn't), the workaround for IntelliJ IDEA is to disable idea_rt launcher agent by adding idea.no.launcher=true into idea.properties (Help | Edit Custom Properties...). The workaround will take effect on the next restart of the IDE.
I don't recommend disabling IntelliJ IDEA launcher agent, though. It's used for such features as graceful shutdown (Exit button), thread dumps, workarounds a problem with too long command line exceeding OS limits, etc. Losing these features just for the sake of hiding the harmless message is probably not worth it, but it's up to you.
Since “this message is harmless”(see the #CrazyCoder's answer), a simple and safe workaround is that you can fold this buzzing message in console by IntelliJ IDEA settings:
【Preferences】- 【Editor】-【General】-【Console】- 【Fold console lines that contain】
Of course, you can use 【Find Action...】(cmd+shift+A on mac) and type Fold console lines that contain so as to navigate more effectively.
add Class JavaLaunchHelper is implemented in both
On my computer, It turns out: (LGTM :b )
And you can unfold the message to check it again:
PS:
As of October 2017, this issue is now resolved in jdk1.9/jdk1.8.152/jdk1.7.161
for more info, see the #muttonUp's answer)
I am using Intellij Idea 2017 and I got into the same problem. What solved the problem for me was to simply
close the project in intelliJ
File -> New -> project from existing resources
use Import from external model (if any)
open the project again.
This happened to me when I installed Intellij IDEA 2017, go to menu Preferences -> Build, Execution, Deployment -> Debugger and disable the option: "Force Classic VM for JDK 1.3.x and earlier". This works to me.
I have found the other workaround: to exclude libinstrument.dylib from project path. To do so, go to the Preferences -> Build, Execution and Deployment -> Compiler -> Excludes -> + and here add file by the path in error message.
Same error, I upgrade my Junit and resolve it
org.junit.jupiter:junit-jupiter-api:5.0.0-M6
to
org.junit.jupiter:junit-jupiter-api:5.0.0
This was an issue for me years ago and I'd previously fixed it in Eclipse by excluding 1.7 from my projects, but it became an issue again for IntelliJ, which I recently installed. I fixed it by:
Uninstalling the JDK:
cd /Library/Java/JavaVirtualMachines
sudo rm -rf jdk1.8.0_45.jdk
(I had jdk1.8.0_45.jdk installed; obviously you should uninstall whichever java version is listed in that folder. The offending files are located in that folder and should be deleted.)
Downloading and installing JDK 9.
Note that the next time you create a new project, or open an existing project, you will need to set the project SDK to point to the new JDK install. You also may still see this bug or have it creep back if you have JDK 1.7 installed in your JavaVirtualMachines folder (which is what I believe happened to me).

Unable to find package java.lang in classpath or bootclasspath with ant [duplicate]

I'm getting this error
Error:java: Fatal Error: Unable to find package java.lang in classpath or bootclasspath
in IntelliJ when I try to build/compile any project. Something that should be stated here is that NetBeans, Eclipse and even the javac command line can compile, build, and execute the same project without errors. This is why I suspect that the problem lies with IntelliJ, all other IDEs work well.
In IntelliJ I already:
Restarted, reinstalled
Invalidate Caches / restarted
Deleted / readded the JDK in Project JDK
Deleted / readded the JDK in Platform Settings
Rebuild / recompile
In Windows I already:
Deleted / Reinstalled Java SDK
Deleted / Readded the JAVA_HOME, PATH and CLASSPATH on System Variables
Tried the above on User Variables
Deleted and reinstalled IntelliJ IDEA
I already seached for issues like this on the Internet, here on Stack Overflow I found:
Question #1 | Question #2 | Question #3 | Question #4 | Question #5
And 30+ sites, and tried every answer...
Here you can see my IntelliJ Project Structure the last time that I tried to build/compile
I was using Java 1.8 when I got this error, after some hours, I installed Java 1.7 and the project worked fine. Maybe IntelliJ doesn't support Java 1.8?
Anyway, it would be great if anyone knew a way to make Java 1.8 work with IntelliJ.
I just spent quite few hours on this and found a solution which might work for you as well. IntelliJ seems to have a bug which expects the JDK to be in a different directory than is specified. I followed these steps:
open intelliJ, click help -> show log in explorer
modify build-log/build-log.xml and change <priority value="info" /> to <priority value="debug" />, you may have to run the editor as an administrator
run the compilation which fails with "Error:java: Fatal Error: Unable to find..."
open build-log/build.log and search for rt.jar, you should find it in a block with a set of other JRE libraries and the directory which points to the file should be wrong
In my case the JDK is included in D:\Development\software\jdk1.8.0_20, while the log points to C:\Users\Vladimir\Development\software\jdk1.8.0_20
I fixed the issue by copying my JRE to the place which is expected in the log. And just like in your case this seems to only happen with JDK 1.8.
The problem comes from IntelliJ bug (existing at least in version 14).
It happens when your JDK directory is under the user profile directory. For example, JDK located in this directory (for Windows):
C:\Users\myuser\jdk1.8.0_20
will be stored in IntelliJ internal configuration (file 'jdk.table.xml') as:
$USER_HOME$\jdk1.8.0_20
But your %USER_PROFILE% environment variable could point at some other (non default) location. Then IntelliJ will look at the wrong directory.
Possible fix:
Install your JDK at different directory, which is outside your profile directory. Like:
C:\Programs\jdk1.8.0_20
Then register this JDK for use in your IntelliJ project settings.
I encountered this on Arch Linux 4.16.13 with IntelliJ 2018.1.4 after importing a Java project using Gradle. I made sure that there is a registered JDK in "Project Settings" -> "Project" but IntelliJ was unable to find the classes from the JDK, java.util.List for example.
The solution was to add a new JDK entry at the same path as the existing JDK (/usr/lib/jvm/java-8-openjdk in my case). This will cause IntelliJ to put the files under jre onto the classpath whereas with the old JDK entry, only the files under lib were on the classpath.
Had the same problem. Simple fix to others in case the other answers are complex.
Go to File -> Project Structure
Under Project SDK, choose new and add another JDK.
The default use in my case was 1.8 that was of build 181. I choose the 1.8.0_192 I had recently downloaded.
After applying, the project loads itself.
When I re-ran the test, it works!
If this problem occurs when importing a project in netbeans then try to create a new project then check the properties of your new created project and match those properties with the project that you imported in my case there was a difference between target of android package version.
From what I understood, debugging for hours, the problem is with the location where the jdk1.8 gets installed(/Library/Java/JavaVirtualMachines/jdk1.8.0_92.jdk/Contents/Home), instead of under System/Library).
So the following has to be done to fix in intellij
1. For an existing project, right click and select module settings, and SDK and add 1.8 as a version.
2. Using a terminal go to ~/Library/Preferences//options/. Remove the old JDK specific lines in jdk.table.xml. Update the default version in project.default.xml
Clean you project in intellij and build. It should use the new jdk and sync.

Eclipse does not start when I run the exe?

When I run the Eclipse.exe within the given folder, it will not start. The Eclipse splash screen will appear for a split second then close. There are no errors.
I've tried practically everything. Updating JDK and JRE: I installed JRE 7 and JDK 1.7.0_40. Both 64 bit, and they are both in the (x86) folder. I've tried re-installing them. And re-downloading Eclipse. Same result every time. I've added the VM to the config, still nothing.
I use Windows 7 and the standard Eclipse for Java IDE.
Go to your Workspace folder then go to Metadata > plugins.
Delete everything from this folder. Then it will work.
Warning: This will delete every configuration from Eclipse!
eclipse.exe -clean -clearPersistedState
All you have to do is go the dir where your eclipse.exe is there and run the above command
The same thing was happening for me. All I had to do was uninstalled Java Update 8
go to : "C:\workspace.metadata.plugins\org.eclipse.e4.workbench"
if already you save backup file "workbench.xmi" replace it else delete this.
This also happened to me. I tried some of the solutions above but couldn't get it done. What i have to do was reinstall the JRE/JDK again and it worked!
When i executed the command "java-version" in cmd, i was getting an error trying to load a class and then when i reinstalled JRE/JDK, it worked all good!
I looked online and found a person who had a similar problem.
It says on the forum
"You might need to download JRE 64 bit version"
But again, it depends on what OS you're using as well.
Kindly check the following:
1) Your eclipse version,whether it is compatible with what version of java.
Have that.
2)Check the operating system specific BIT requirements either 32/64 with eclipse version.
3)Usually java will be installed in ProgramFiles for Java if both OS & Java are 64 bit else it will be in ProgramFiles(x86) if java is 32bit and OS is 64Bit.
4)Last but not least check the environment variables for Java whether it meets the requirements of your eclipse version.
Hope this Helps you!
What system you have - 32-bit or 64-bit? You say it was installed into (x86) folder. But normally (x86) is a default for the 32-bit JDK, not for 64-bit JDK. If you used defaults, then it seems that you installed 32-bit JDK instead of 64-bit.
The actual issue should be with the OS architecture, the JDK (32bit or 64 bit) installed and the eclipse type u installed.
Bring them in sync, things would work completely fine.
Just have a check at the Eventlog as mentioned by #Viji
Ideally u should encounter error like RADAR_PRE_LEAK_64
If its a Java version problem, you can edit the eclipse.ini file and assign the compatible version to the application through adding these lines:
windows example:
-vm
C:\jdk1.7.0_21\bin\javaw.exe
for more information:
https://wiki.eclipse.org/Eclipse.ini
Press Win key + X
click 'System' link from popup menu
click advance setting link (Left panel) in opened 'System setting' window (Control Panel\System and Security\System)
Now a window named 'System property' will be open, select 'advance' tab and click on environmental variables
Select path variable from 'System Variable' list section. and click edit
click new button on newly opened window and paste your Jre folder link(Jre in JDK) click okey , okey , okey
re run your program :p
re install your java. First check your OS version.
Just simply uninstall java 8 update 45, it worked for me. Also you might need to delete the metadata of your workspace as I have first deleted the metadata and then uninstalled java 8 update 45.
If eclipse (none of them) doesn't launch at all and there's not even an error message, uninstall Java 8 Updater and reinstall Java 8 from scratch, this should work. Have luck!
Try to install Eclipse into a folder without spaces.
Same problem happened with me . I started eclipse after many days , but it was not starting.just eclipse window flashing , no error nothing. After many trials , i just re-installed my jdk . It worked for me, i think some of my java files were missing or damaged . Try by reinstalling your jdk version it may work as it worked for me.
I tried everything except this. After rigorous trials,Uninstalling java 8 update 25 helped me.
did not have to uninstall Java JDK - just ran installer over my existing install. Not sure what was wrong but this fixed my issue with Eclipse not starting.
I had a similar problem with Eclipse mars. It suddenly over the weekend stopped working and if you ran it from a command window (Windows x64) it would flash up a line or two and then stop.
I installed Eclipse neon yesterday and it worked, but today it stopped working and went wrong in the same way.
Just now I installed the JDK from here:
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
I installed version 8u101 and then neon started. I have not changed eclipse.ini (although I had a look at it) nor have I deleted the plugins (I renamed the folder and found that this had no effect).
Hence I think this difficult to work out problem relates to the JDK/JRE. It would be nice if Eclipse gave a bit more information to go on, but such is life.
I just had this issue in Eclipse Neon. After trying all these suggestions, it turned out that in my case the problem was improperly configured path variables.
There is a pretty good answer already posted here which explains it, but I'll summarize it in this answer for convenience.
You will need to go into your User Environment Variables panel and modify the following values:
JAVA_HOME : C:\Program Files\Java\jdk1.8.0_102
JDK_HOME : %JAVA_HOME%
JRE_HOME : %JAVA_HOME%\jre
CLASSPATH : .;%JAVA_HOME%\lib;%JAVA_HOME%\jre\lib
PATH : your-unique-entries;%JAVA_HOME%\bin (make sure that the longish your-unique-entries does not contain any other references to another Java installation folder.
In my case the problem was not having a proper javabin folder in the PATH variable.
Open the PATH variable and make sure it points to a proper JRE bin folder.
Same thing happened to me.
I was using dual monitor and eclipse opened on my other screen, behind a full-screen window.
I have fixed it by deleting the .metadata/.lock file.
In my case I did see the splash screen hanging at
loading org.eclipse.egit.ui
So I deleted everything starting with org.eclipse.egit within the eclipse\plugin folder
Reinstalling eclipse (newer version) did the trick for me.
Seems to be rare but this happens on windows 10 where the eclipse.exe file is located in a sub-folder which has some UTF-8 folder parent
For example this :
D:\Personal\Idea\دستیار هوشمند بانکی\eclipse doesn't work while
D:\Personal\Idea\Bank AI Assistants\eclipse works.
In my case, moving eclipse to a new fresh machine, I had wrong path of lombok.jar in eclipse.ini
check all eclipse.ini configurations
In System Environment variables , add jdk path in the BEGINNING of the Path
.

Categories