I had been having problems getting Eclipse to build some of my Ant scripts (some built fine, others didn't). Basically, I would get no output in the Eclipse Mars.1 Release (4.5.1) console. My build.xml works fine with ant when I run it on the command line. I was able to find some output in workspace/.metadata/.log where I found the following error message:
!ENTRY org.eclipse.ant.launching 4 120 2016-03-03 09:58:38.197
!MESSAGE Error logged from Ant UI:
!STACK 0
java.net.SocketTimeoutException: Accept timed out
at java.net.PlainSocketImpl.socketAccept(Native Method)
at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:409)
at java.net.ServerSocket.implAccept(ServerSocket.java:545)
at java.net.ServerSocket.accept(ServerSocket.java:513)
at org.eclipse.ant.internal.launching.launchConfigurations.RemoteAntBuildListener$ServerConnection.run(RemoteAntBuildListener.java:89)
which other people have asked about on Stackoverflow.
The other odd thing I noticed was that there's a line of text right above the console showing which java which shows the version of java being used, and working scripts were different than non-working. Working ant build scripts were using jdk1.7.0_79 whereas failed ones were using the /System installed 1.6.
I don't know why java 1.6 wasn't working for me, but eventually I found where I could change Java for ant builds. It's in Run/External Tools/External Tools Configuration.../<select failing build>/JRE. Oddly, after getting it to work and then trying to switch back to 1.6, it gives me the following message when running ant:
JRE version less than 1.7 is not supported.
so who knows why 1.6 was picked in the first place (maybe the project itself is 1.6) or why it didn't give me a warning!
Anyway, there seems to be several causes of the error I posted above, but here's something you can try.
Have had almost the same problem on Eclipse Oxygen, Java 1.8 and Ant to deploy to tomcat7.
Eclipse’s Console doesn't output any error message. It just says „terminated“ when I clicked Run Ant on the build.xml file. WTF
To solve this I had to set everything to java 1.8 especially ant's runtime JRE . But the „Java Compiler“ -> „Compiler compliance level“ has to be set to java 1.7 only.
Actually it is pretty simple. Well classpath settings can be tricky sometimes ;) especially without any error message.
Do not forget to check your ANT_HOME settings: Eclipse -> Prefs -> Runtime -> „Restore Defaults“ should be sufficient. (Eclipse comes with Ant 1.10.1 as default which requires Java8 at runtime.)
And: If it works for some build.xml-files only you are overriding your workspace settings with your ant-build process. To solve this: Click on „Run As“ -> „Ant Build ... “ (NOT „Ant Build“) and check your classpath (for ant) and the JRE settings here to Java 1.8
Regards
Well simply check your ANT_HOME setting.
Related
This machine has had multiple version of Java JDK installed and multiple version of multiple IDEs (Netbeans, IntelliJ, Eclipse, etc.) Most recently, I have added JDK 15.0.2 and Netbeans 12.2. When trying to compile a simple "Hello World", this is the output that results:
ant -f C:\\Data\\NetBeans\\grading\\TestGrading -Dnb.internal.action.name=run.single -Djavac.includes=testgrading/HelloWorld.java -Drun.class=HelloWorld run-single
init:
Deleting: C:\Data\NetBeans\grading\TestGrading\build\built-jar.properties
deps-jar:
Updating property file: C:\Data\NetBeans\grading\TestGrading\build\built-jar.properties
Compiling 1 source file to C:\Data\NetBeans\grading\TestGrading\build\classes
**warning: [options] system modules path not set in conjunction with -source 11**
**1 warning**
compile-single:
run-single:
Hello World!
BUILD SUCCESSFUL (total time: 1 second)
As you can see, the file compiles and runs, but the warning is causing me concern. I have not been able to find a similar warning in my searches... (all of the warnings refer to "bootstrap class path not set" instead of "system modules path not set"
I have updated my Environment Variable to reflect the most current JDK with this entry:
JAVA_HOME=C:\Program Files\Java\jdk-15.0.2
What setting am I missing that wasn't properly updated as I've updated my JDK and my IDE? Or am I completely looking in the wrong places? Or do I need to fully uninstall previous versions and, if so, what will that do to previous code written using those previous versions that I'd still like to retain?
Thanks in advance!
I stumbled on the issue and the fix! While the new install changed the Java Platform in the Libraries properties to correctly point to JDK 15 as the new (Default), in the Sources area, towards the bottom, it left the Source/Binary Format still showing JDK 11. Changing this manually to JDK 15 made the warning go away. The warning message should have said something to the effect of "Source/Binary Format" does not match Library Java Platform - check corresponding versions."
It is sometimes happened because of java updates. When the newer version is needed,it says you to remove the older version. If you didn't do that this cause come confusing. You can better use older versions to solve this problem. Maybe this can help you.
I had this exact same warning, which in my case ended up as an error and caused build to fail when runnning mvn commands. I was using jdk 16 and also had 11 installed.
In my case, nothing has fixed it except to fully uninstall java from my mac and reinstall the versions I needed from https://adoptopenjdk.net/.
You need to update your JAVA_HOME environment variable.
On Mac update your ~/.bash_profile or ~/.zshrc. Make sure you have the version you want installed and make -v## the version you want to use. For example,
To use Java 11,
export JAVA_HOME=`/usr/libexec/java_home -v11`
To use Java 17,
export JAVA_HOME=`/usr/libexec/java_home -v17`
On Windows change you system environment variable to your new java version.
Heres how! (Confluence)
Windows 10 OS. I'm using a Cygwin BASH console to run Gradle.
I've been struggling with this for a few hours now. There are one or two questions on SO which seem to relate this but I'm still a long way from understanding the basic mechanisms and how to get Gradle to use the right JDK/JRE.
This started earlier when gradle build didn't work and complained that it couldn't find "tools.jar". This appears to be a sign that the path to the Java JRE used to run the Gradle app isn't associated with a JDK. This is indeed the case: the JRE it insists on using to start up is at "C:\Program Files\Java\jre1.8.0_73\". This is a JRE without a JDK.
The JDK I want Gradle to use is at "D:\apps\Java\jdk1.8.0_191\".
I have set JAVA_HOME to this value. I have also placed "D:\apps\Java\jdk1.8.0_191\bin\" at the very start of the PATH environment variable.
In both Cygwin and the W10 console, when I go "java -version" it prints out the 1.8.0_191 version, proving that the OS System is configured as expected.
But Gradle itself insists on using the JRE in C:.
I tried numerous experiments and rebooted numerous times.
When I went, in build.gradle:
println "java.home is ${System.properties['java.home']}"
... it always printed out the C:\ location version (1.8.0_73)
Finally I made this impossible by renaming "C:\Program Files\Java\" to "C:\Program Files\JavaXXX\". This then gives:
Chris#M15B /cygdrive/d/My Documents/software projects/EclipseWorkspace/LuceneIndexer_3
$ gradle build Error: could not open `C:\Program Files\Java\jre1.8.0_73\lib\amd64\jvm.cfg'
So it appeared, as far as I could surmise, that something inside Gradle has got its heart stubbornly set on using a particular JRE location... which disregards the JAVA_HOME variable, the PATH entries and the OS's own understanding of which JDK/JRE should be used... and even sets System setting java.home to a "spurious" setting (or one I don't want to use).
Finally... I put this line in gradle.properties:
org.gradle.java.home=D:\\apps\\Java\\jdk1.8.0_191
When I then changed "C:\Program Files\JavaXXX\" back to "C:\Program Files\Java\", finally the thing built properly. And finally java.home was printed out as "D:\apps\Java\jdk1.8.0_191". But when I again renamed to "C:\Program Files\JavaXXX\" the "could not open" error returned. In other words, even if you can configure java.home in Gradle, Gradle itself appears to be reliant on a version of Java that you don't want it to use, and which is not the version for which the OS is configured!
How on earth does the Gradle application find the JRE it is going to use to do its business? Surely there must be a way to get it to use another one?
later
I also tried adding some ECHO statements to the gradle startup script... in which there is a specific section devoted to determining the JVM to use. These experiments showed clearly that this script is correctly using the desired JDK (under D:). Nor can it be a Cygwin-related problem, as other Cygwin commands work fine when Java\ is renamed to Java_XXX. I also examined the registry: no clues found.
By going "gradle" at the Cygwin command prompt, something somewhere in the works insists on using a baked-in JRE location, even before the gradle startup script is run...
I was able to resolve this by upgrading my system's Java and Gradle. I changed to Java 9 (although apparently we're on Java 11 at the time of writing). I also changed to Gradle 5.2.1 (from 3.5). I think I concluded that Gradle 3.5 was incompatible with Java 9...
I was quite confused: for a moment it appeared that Cygwin was out of date and that I needed a newer version of its Gradle. But in fact Cygwin was inheriting PATH from W10, and one of those PATH entries was "%GRADLE_HOME%\bin". Cygwin was using the W10 Gradle. What fun to be using a Windoze OS!
GRADLE_HOME (different from GRADLE_USER_HOME, where dependencies are downloaded!) thus had to be changed to the location of the new version of Gradle.
All sorts of funny consequences followed for Eclipse: the dreaded red exclamation marks... caused by the fact that under "Project and External Dependencies" for several projects the dependencies revealed themselves to be located in the old 3.5 GRADLE_USER_HOME location, which I had renamed deliberately to make it inaccessible. I found no way to "rebuild" these dependencies in Eclipse (i.e. to force use of GRADLE_USER_HOME, now pointing to a location under ...5.2.1), and instead opted to recreate the Eclipse projects.
Quite trying. There must of course be a better way.
Incidentally, it does indeed appear that when you run a Gradle command in Cygwin the JVM as configured for your OS in the "Java Control Panel" gets invoked before the gradle startup script is run (... I think). Even if your JAVA_HOME setting and first PATH entry are pointing to a different JRE (which they probably shouldn't be).
Let's make the long story short. Here is what happened:
IntelliJ 12 CE downloaded and installed
Latest Java 1.7/1.8 downloaded and installed
JDK was setup to make and run the project
I faced the following strange error:
Error: java: System Java Compiler was not found in classpath
This was despite of the fact that I had Java 1.7/1.8 fully installed and had no problems working with it through the terminal.
The solution that fixed my problem was as follows:
In:
Project Settings > Compiler > Java Compiler
I changed the drop down Use compiler from Javac to Eclipse!
Non of the other solutions I found on the web was helpful. Hope this helps you my unknown fellow reader.
IMPORTANT: THIS HAD NOTHING TO DO WITH MY JAVA_HOME AS IT WAS SET CORRECTLY.
You need to set environment variable JAVA_HOME. The IDE will check that variable on startup.
And enter the path to the home dir of installed JDK. Once it started it should point to the JDK used to run IDE. In this case the new compiler will be available among compilers already configured. You can always configure any new compiler using IDE compiler settings.
i found that if you install vscode java plugin in your mac , IDEA will not work correctly.
so disable the java plugins in vscode.
Every thing gonna be alright
I'm trying to build a java project using netbeans ide,but i keep getting
Please build using Ant 1.8.0 or higher
error,i think this is due some version difference in the netbeans IDEs,
How can i resolve this issue
In NetBeans options, you can set Ant home. Point this to the other installation.
Mine is:
/usr/local/netbeans-7.2.1/java/ant
the default installed with netbeans.
It doesn't work for me...
I got ant version 1.9.10 and java openjdk 11.0.6 (on linux LEAP 15.1)
I want to build without launching Netbeans 10 in order to automate the copy/build process of my application stored on a distant server (lock down style ^^).
each time I use the command ant -buildfile build.xml I got this error message :{
After seeking and observing, I find out that netbeans uses its "own" ant version but either the command, outputed to Outout tab,
ant -f /netbeans/java/MagicArena -Dnb.internal.action.name=rebuild clean jar
nore
/usr/local/netbeans/extide/ant/bin/ant -f /netbeans/java/MagicArena -Dnb.internal.action.name=rebuild clean
...are giving (BIG) satisfaction :{
I got the same message at command line:
/netbeans/java/MagicArena/nbproject/build-impl.xml:111: Java 9 support requires Ant 1.10.0 or higher
:{
I got an error when trying to update my Eclipse!
Here is the error log
An internal error occurred during: "Install download 0"
java.lang.IllegalArgumentException: Comparison method violates its general contract!
at java.util.ComparableTimSort.mergeHi(ComparableTimSort.java:835)
at java.util.ComparableTimSort.mergeAt(ComparableTimSort.java:453)
at java.util.ComparableTimSort.mergeForceCollapse(ComparableTimSort.java:392)
at java.util.ComparableTimSort.sort(ComparableTimSort.java:191)
at java.util.ComparableTimSort.sort(ComparableTimSort.java:146)
at java.util.Arrays.sort(Arrays.java:472)
at org.eclipse.equinox.internal.p2.artifact.repository.MirrorSelector.hasValidMirror(MirrorSelector.java:319)
at org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepository.downloadArtifact(SimpleArtifactRepository.java:577)
at org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepository.getArtifact(SimpleArtifactRepository.java:680)
at org.eclipse.equinox.internal.p2.artifact.repository.MirrorRequest.getArtifact(MirrorRequest.java:260)
at org.eclipse.equinox.internal.p2.artifact.repository.MirrorRequest.transferSingle(MirrorRequest.java:235)
at org.eclipse.equinox.internal.p2.artifact.repository.MirrorRequest.transfer(MirrorRequest.java:191)
at org.eclipse.equinox.internal.p2.artifact.repository.MirrorRequest.perform(MirrorRequest.java:122)
at org.eclipse.equinox.internal.p2.artifact.repository.simple.SimpleArtifactRepository.getArtifact(SimpleArtifactRepository.java:664)
at org.eclipse.equinox.internal.p2.artifact.repository.simple.DownloadJob.run(DownloadJob.java:63)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Does any one know how to solve this problem?
Thanks
This happened to me before and now i have Eclipse Juno Release and I don't come across such issues.
Possible Workarounds:
This error occurs because of a small bug in Eclipse when used with JDK >= 1.7
To resolve it, you can replace the JDK 1.7 by JDK 1.6 (Of-course changing the Environment variables, PATH, and such)
(OR)
Exit/Close any Active Eclipse IDE Window, Process,...
Then open the Eclipse Installation folder and examine the "eclipse.ini" file.
You might see some configuration entries that are required to initiate Eclipse IDE during startup
Now copy paste the (system property)entry below "-vmargs" in "eclipse.ini" file:
-Djava.util.Arrays.useLegacyMergeSort=true
Save it!
Now Open Eclipse and Perform Update and it should complete Normally.
Then You can remove the Line from the "eclipse.ini" configuration file.
I hope you won't get any such bugs in Eclipse Juno Release even with JDK 1.7.
Possible Root cause of the Problem: TimSort algorithm in JDK 1.7
reference: https://bugs.eclipse.org/bugs/show_bug.cgi?id=317785