I have given atask to buld the ant file.
The interestuing path is there is no JDK installed, only JVM is installed.
It seems to me that Eclipse is using internally JDK.
Now, when I run the ant file it's throwing me an exception Unable to find a javac compiler; so how Can I fix this ?
I found this in the current Eclipse help: Using the ant javac adapter
The Eclipse compiler can be used inside an Ant buildfile using the javac adapter. In order to use the Eclipse compiler, you simply need to define the build.compiler property in your buildfile.
This might also work in Eclipse 3.4. Ganymede help files aren't online.
Edited to add the ant compiler property definition:
<property name="build.compiler"
value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
Eclipse JDT (Java developement tool) is able to run on top of a JRE only as you said because it embed its own Java compiler. I think you can use this compiler to compile code outside Eclipse but I am not able yet to find ressources on the web explaining how to do this.
Moreover I am not sure you will be able to tell Ant (here I speak about Ant running outside Eclipse, because Eclipse also has its own internal Ant runner) to use this compiler instead of using the javac compiler find in default location.
Related
I am working as an eclipse plugin developer and when I try to build my eclipse sources from command line using ant, it fails with following error.
java.lang.NoClassDefFoundError: org/eclipse/jdt/internal/compiler/impl/CompilerOptions
I am using java 1.7_72, eclipse 44, ant 1.7.1
It was working with this configuration for long time on my machine, and it suddenly started failing with this message. I have tried various options like uninstalling and reinstalling all the possible software that could affect, gone for fresh copy of eclipse, ant and much more.
It works on my colleagues machine and we all use the same software eclipse/ant/java etc.
Any inputs are welcome.
Thanks a lot in advance.
I have been struggling with similar error using Eclipse's PDE headless product build scripts.
The error occurs when the builder executes a temporary build.xml file that it generated for my plugin. this build file compiles my plugin code.
trying to run this temporary build file manually with ant on the command line works though.
Obviously, the error suggests an issue with the JDT compiler.
Looking at the generated build.xml, I found out the following target:
<target name="properties" if="eclipse.running">
<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
</target>
which tells the builder to override the default JDK compiler when the property eclipse.running is true.
I added
<property name="eclipse.running" value="false"/>
at the beginning of my build script: the error disappeared and my build completed successfully
In my case, the issue also appeared during PDE headless build with Eclipse Neon. The build script property (baseLocation) was pointing to a running instance of Eclipse.
Closing Eclipse before running the build resolved the issue.
The issue appeared after an update of the Target Platform. It ended up to include a newer version of Eclipse and JDT in addition to installed version.
It showed up again after update from Eclipse Neon to 2019-03 (4.14). Adding the -data <workspace>" to the eclipse launcher command-line solved it.
While trying to run Jython Scripts in Eclipse using PyDev, I noticed that the Jython run configuration was not pulling the java classpath value from maven/m2eclipse.
Has anybody configured eclipse so that PyDev pulls the correct classpath from maven?
Notes:
I can in fact run jython scripts, and import classes from the jre, but my maven dependencies do not appear on the classpath when interpreting the Jython scripts
I have seen the question/answer Using Jython with M2Eclipse and have used maven plugins to execute jython scripts, but that is not what I am interested in
Thank you all.
Update: Looking at extending PyDev plugin to initialize jython run configurations with the project classpath (containers). Trying to figure out which extensions I have to depend on to get access to the .classpath file.
Update: Figured what I need to change and how. Working on it now.
Someone Else Seems to have the same problem, and may have solved it: https://github.com/Kbrowder/PyJDT
Edited: Posted Prematurely, updates
Turns out Someone has already written an eclipse plugin to solve this exact problem.
The plugin is called PyJDT: https://github.com/Kbrowder/PyJDT
Tested it on Eclipse Juno with PyDev.
Thank you K. Browder
I've just installed Eclipse, after i installed the java JDK.
The Getting Started guide (in Eclipse) says i should reference my JDK installation in Window>Preferences>Java>Installed JREs, but that a JRE would also work.
Select the Java > Installed JREs preference page to display the installed Java Runtime Environments. Confirm that a JRE has been detected. By default, the JRE used to run the workbench will be used to build and run Java programs. It should appear with a checkmark in the list of installed JREs. We recommend that you use a Java SDK instead of a JRE. An SDK is designed for development and contains the source code for the Java library, easing debugging.
There was already a JRE set up there (not a JDK), so i did nothing and tried to compile a Hello World (just to see what would happen). To my surprise, it compiled!
I searched a little bit and it looks like this works because Eclipse has a built-in Java Compiler. I tried debugging using the same eclipse set up, and it was also successful.
So, what is the difference between setting a JDK and JRE there? Why is it important to download the JDK, since in my default configuration Eclipse doesn't seem to use it?
Probably the main difference is you get the source to all of the Java runtime libraries (with the JDK) which can be a big help. I always use the JDKs for that reason.
Also if you are debugging, this will allow you to meaningfully step into Java runtime libraries.
There are a number of tools that come with the JDK that don't come with the JRE - JConsole (http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html) springs to mind. This for example can help you understand & monitor the memory usage of your application and so on. Either way if you head into unfamiliar territory, I highly recommend you follow the Eclipse suggestion and use the JDK!
JDK is equipped with different helpful tools, as DotMasta mentioned. Eclipse's "version" of JDK is called JDT. Apart from range of shipped tools, there are also differences between javac and Eclipse built-in compiler ecj, so check here to see the comparison. One of the most important differences is that javac is strict, i.e. with ecj you can create a class file even in case of errors in code, which is perfectly suitable for testing phase, but not for launch :)
JDK contains software development tools which are used to compile and run the Java program.
Plenty of classes and methods in standard jdk library
Javac java compiler
Diffrences and why you will need this?
JDK includes the JVM, standard class libraries, and several other tools that a developer needs in order to create a Java program.
JRE includes the JVM, as the JRE provides some standard libraries and the JVM which can be used to execute a Java program.
You can even look there: http://en.wikipedia.org/wiki/Java_Development_Kit
I always get the above mentioned error when i restart eclipse.I have gone through other posts in stackoverflow and understood how to resolve the problem( i.e by changing configurations in windows>prefernces and editing eclipse.ini file).
But the basic question is what is the meaning of that error?Someone please explain and also provide link to resource on how eclipse works internally with those preferences set.
Thanks in advance..
The JRE runs Java applications. The JDK can also compile Java source code, which is what your Eclipse is trying to do.
Basically Apache Maven requires a Java compiler (javac) which is not part of a Java runtime environment. (JRE) So it asks to use Java Development Kit (JDK) instead because JDKs are including a Java compiler. Nearest explanation for this can be found in below link.
http://wiki.eclipse.org/M2E_FAQ for question "Unable to locate the Javac Compiler Error". How to force Apache Maven to use the Eclipse Java Development Tools (JDT) as its default compiler can be found here.
I have a simple question regarding groovy with eclipse. I downloaded the plugin as mentioned and i didnt have problems with installations but i have compiler errors in hello p. the problem in my opinion that eclipse isnot using the groovy compiler. but i have no idea what to do
Is the filename extension .groovy?
Are you sure the project has the Groovy nature? (right-click on the project, and ensure Remove Groovy Nature appears. If Add Groovy nature appears, then the project doesn't have a groovy nature, and therefore the groovy compiler won't work).
Could you also post the file that isn't compiling. There might be something wrong with what you typed.
Make sure you are opening the file in a Groovy editor.
Look for any exceptions in your error log.
Also, just in case, you can try uninstalling and reinstalling the plugin. I'd recommend using the latest milestone version as that one is about to be promoted to 2.1.2 final.
http://dist.springsource.org/milestone/GRECLIPSE/e3.6/
I confirmed that Groovy plugin isnot workingn on mac. I tried it on 2 machines and they are giving the same error. Groovy plugin is working on windows without problems :)
NetBeans is a better option for Groovy+Java development. You can mix Java and Groovy files in a Java project in NetBeans. It also creates a distributable jar for your project. No classpath and jar issues with NetBeans created MET-INF file.