Does the version of Eclipse affect the version of code? Suppose, developers are using different version of Eclipse for same version of code with same version of JDK. Will it cause any issue?
No, the version of Eclipse does not matter.
Eclipse has extensive configuration for exactly which version of Java you are targeting. For example see the 'Java > Compiler' settings in the Preferences, and the 'Compiler Settings' in the Properties for a Java project.
You can also tell Eclipse which JRE/JDKs you have installed (see the 'Java > Installed JREs' page in the Preferences). You can run your code using any of these JREs, this is completely separate from the version of Java you are using the run Eclipse itself.
You do need to run a version of Eclipse which understands the version of Java you want to use. So for Java 13 you need to use at lease Eclipse 2019-12.
Of course newer versions of Eclipse contain more tools for helping with Java development and more bug fixes so using an up to date version is recommeneded.
Eclipse is simply an IDE (Integrated development environment). It combines debugging, compiling and other convenient tools for development. on the other hand, the Java code itself is separate, and you don't necessarily need eclipse to write the code. In fact, a simple text editor is enough. All you need is a file with a java extension (Example: hello.java).
It depends on what users share. I'm assuming you're using some sort of SCM, in which case the same project (fully shared) on different versions of the IDE can possibly lead to annoying situations.
There would be no issues in general, as far as producing the code is concerned, except in situations where some versions of IDEs don't support the required Java version (or other features). But I see this more as the user being affected rather than the project/code.
Here's what you should keep in mind:
Keep IDE project configuration files (such as .project, .settings, .classpath) ignored by your SCM system
All Java configuration should be based on a build tool. Use Maven/Gradle, etc, and any modern IDE will be able to create a project from its config file. The IDE would derive local configuration files which should not be sent back to shared repositories
This way, all developers are free to use whatever IDE (and whatever version) without causing interference, and CI tools will work off build tools' configuration as well.
Related
I recently downloaded VS Code for Java development. When I initially opened an existing Java Project in VS Code, it was unable to identify objects from the Selenium library. I downloaded the Java Extensions plugin and a few others, and now VS code will not recognize any of my imports as valid. Javax and Java.swing are among the now undetectable libraries. Is there a setting I missed? What do you recommend?
VSCode just an Editor, after you install some extensions, it only makes the editor more convenient, get more abilities even can help you develop the project of some kind of language through combine with the language support in your computer. Such as, you need to install JDK, then to install the 'Java' extension, then the extension to combine with the JDK and the VSCode, then you will get the ability to develop java project in VSCode.
That's means, The 'Language Support for Java(TM) by Red Hat' has nothing to do with java development. For example, after you install the JDK on your computer, you can develop java projects in the other IDEAs such as Intellij IDEA or some others. The 'Language Support for Java(TM) by Red Hat' extension just to combine the JDK with VSCode better, to make VSCode better to develop java project.
As you said, you failed to import libraries. Of course, the 'Java' extension without any libraries of java. You need to configure it by yourself. In the Explorer panel, you can find 'JAVA PROJECTS'. In it, you can find which libraries you have referenced and you can adds libraries in it. And of course, you'd better take maven to manage your project.
By the way, recommend you to install 'Java Extension Pack' extension.
You're going to need to add support through extensions because by default VS Code does not support Java. The great thing about this extension is that you get a slue of other extensions as well, such as; maven, debugging tools, support for junit, auto completion, etcetera.
On a side note, you could always use an IDE/IDEA like IntelliJ, Eclipse, or likewise. I'm definitely partial to IntelliJ but they all have their pro's and con's.
I'm considering bundling a JRE with my Java application. I'm using Launch4J. Looking around stackoverflow this seems easy enough to do. What I've not seen any information on is where I get the JRE from in a controlled manner.
I'd like to be able to control from a single place what version of the JRE is bundled. I don't want to be manually updating/installing JRE's on n number of build machines each time we decided to use a different JRE. Placing the JRE under source control seems the most logical option. Our build is done using maven, I assumed there would be some kind of maven plugin that would download a configured JRE version and put it in the target folder for you.
So, what is best practice to control which JRE is bundled with my app?
check the Maven enforcer plugin http://maven.apache.org/enforcer/enforcer-rules/ and in that check for requireJavaVersion http://maven.apache.org/enforcer/enforcer-rules/requireJavaVersion.html . this will add checks to the build that fail when the inapproriate JRE is used.
I recently had to migrate to a new machine and re-installed Eclipse.
At the moment, I need to generate JAXB classes from an xsd. I cannot quite remember what I installed, but in my old Eclipse I had the option -rightclick-generate-jaxb classes.
Who knows what I have to install/plug-in to get it back?
I was looking at installing Dali, which seems like it could be right, but I am pretty sure I did not install Dali last time. I also included the jaxb jars in my build path, as last time, so that should be ok.
I am using Eclipse 3.6 and Java SE 1.6.
If you don't have JavaEE:
Help>>Install New Software>>Works with:--All Available Sites--
Search for JAXB
Then select Web, XML, Java EE and OSGi Enterprise Development and install.
After you restart Eclipse you should see the generate option.
A simple fix for this problem - rather than worrying about adding additional plugins or installs - is to install Eclipse IDE for Java EE Developers rather than Eclipse Classic (both to be found here). This comes with the JAXB support and therefore provides the >Generate>Jaxb classes option.
The above methods may work, but actually the options comes from a plugin called Web Tools Platform which comes along with Eclipse IDE for Java EE Developers.
Don't worry about reinstalling eclipse or try out other methods. No matter what eclipse you use simply install this plugin by following the below procedure. You will get the "JAXB Classes" Option on click of "Generate" button.
Help --> Install New Software --> Add
Name : Web Tools Platform
Location : http://download.eclipse.org/webtools/repository/helios
Hint : In case if you are using a different version replace helios with your eclipse version name. I used it as luna. So the path looks like http://download.eclipse.org/webtools/repository/luna
And restart eclipse. Now you will have that option.
(I'm using IBM's Eclipse-based RAD, so I don't know whether this applies to raw Eclipse.)
Have a look at your project Facets (select project, rightClick->Properties, Project Facets) I have the option of selecting JAX/RS.
later: I've checked my plugins and by default I get Dali installed and it does contain some JAX/B-related stuff. I suspect you do need this.
After a lot of research here is what I have done to fix the issue.
Windows> Preferences> Java> InstalledJREs...make sure to point your jre to the jdk directory. I was pointing to JRE and as soon as I changed it to JDK, it started working.
Hope this will help you guys.
I installed this plugin
http://java.net/downloads/jaxb-workshop/IDE%20plugins/jaxbw-plugin.zip
i.e. unzip and copy to eclipse/plugin folder.
It adds an entry "JAXB 2.1 > Run XJC" to the context menu of *.xsd files.
So the menu's not really in the proper place, but it works.
In order to support the standard JAXB APIs in the IntelliJ IDEA Community Edition environment, you need to make some adjustments. One way to implement JAXB technology is to connect the xjc.exe utility included in the JDK toolkit. This utility can be launched at the command prompt, but it is advisable to configure the context menu:
In the Settings window, select Tools | External Tools and press the
"+" button.
In the Edit Toolbox dialog enter:
the name (Name :) of the new Generate JAXB Classes command;
the path to the xjc.exe utility (Program :), which should be selected on the particular computer in the file selection dialog(button "..." )`
parameters (Parameters :) which in our case will be as follows:
$ p $ FileFQPackage $ $ SourcepathEntry $ $ FilePath $
In order for the created command to work correctly, the schema file should be placed in a new package, which will then appear with the generated files.
In the settings window, Tools | External Tools - "Your command name" will appear.
All you need is to open your schema file and run the command.
you may download JAXB Eclipse Plug-In
jaxb eclipse plugin
I had the same issue while attempting to generate java classes from xsd file.
My installed Eclipse is:
Eclipse Java EE IDE for Web Developers
Version: Oxygen.3a Release (4.7.3a)
Build id: 20180405-1200
I solved it changing the workspace default JRE from JRE to JDK in Project Properties / Java Build Path / Libraries
This link describes how the problem arises:
https://www.youtube.com/watch?v=zgblFjA-5Ks
This link explains how to change the default JRE.
https://www.zkoss.org/wiki/Setting_Default_JRE_In_Eclipse
Hope this helps
If you're using Eclipse EE all you have to do is switch your running environment from JRE to JDK and that should fix it. Windows -> Preference -> Java -> Installed JRE -> Add - > (Choose Standard VM) Then Select JDK!
Then Execution Environments under Installed JRE select your JavaSE-1.8 or your version and also select JDK!
There are different version of eclipse for different development environment.
My question is IF IDE remains same then why different versions, and if someone want to use all supported environments in single IDE how he/she can achieve that.
I want to use eclipse as single IDE for PHP, Java & Reports and Android development, instead of using different installation of eclipse.
Somebody helps me or refer me some link, it's quite confusing!
All the versions of Eclipse on the main site download page are the same version of Eclipse, but packaged with different sets of plugins. You can always install more features in Eclipse by installing more plugins.
You can have a single installation of Eclipse and use it for all your development needs - depending on your tastes however, it may sometimes be more manageable to have separate installations of Eclipse for different tasks (when there are a lot of plugins, Eclipse can take noticeably more time to start.)
There ARE different versions of Eclipse out there. But if we stick to one version and look at why there are different variants to download it's basically just that they come prepackaged with a specific component. So if you would like to use your Eclipse for C++ development you can get going with on single download. Instead of downloading the main IDE and then adding the module to support C++.
But after you install Eclipse, with any prepackaged modules, it's easy to add new ones. Say you have Zend Studio which is a PHP IDE based on Eclipse. You can still add all other modules supported by the version of Eclipse that Zend Studio is based on. For instance the Android SDK kit for Android development. You can add most modules by doing a search for them and finding the url to it's update site. Then click Help->Install New Software. Then you click Add and add the URL of the Update site of the module you wish to install.
Then you can select it from the Work with drop-down and it should appear in the list. Select it and click Next.
That way you can install almost all available modules for Eclipse. Note that sometimes you can run in to compatibility issues between installed modules and dependency problems. But most of the time it works fine.
They are not different versions, just the same backend with plugins for the particular language. Just that the specific versions are configured for best use with the language specified. If you want to use more languages than the default one in the eclipse you downloaded, just download the plugins you require and install in your installation of eclipse
Eclipse is plugin based IDE and these plugins may not like each other sometimes. It will be better to use more installations. In fact if you are developing Java and PHP you will need only 2 of them.
STS is a good Java toolkit especially if you work with spring.
If you new to Eclipse you should know that it can go crazy couple of times per month if you install too much and it is very annoying to see that one day your webapp is deploying and second day no...
Keeping installation separated you will have better control.
I am trying to recompile an existing Java project exported from Eclipse. It is necessary to recompile this because I am running simulations remotely on other machines where a different (older) version of Java is installed. I have tried recompiling my .java file which specifies the simulation in question. However, it appears that it is necessary to recompile all other classes etc as well. Has anyone got an idea how to do this WITHOUT using Eclipse (I am not the Admin on the other machines and thus Eclipse is unavailable to me) and not manually because the project is quite huge?
Thanks a lot for any suggestions!
I recommend you to always have an command line way to build an application. The usual way to do this in Java is using ANT (or Maven).
As #Santiago Lezica says, Eclipse can generate an Ant file.
I believe that Eclipse allows you to build for an older target platform than the one you are currently running. That way you can do all of your builds locally.
The second approach has the advantage that you can fix any problems arising from compiling for the older platforms (e.g. use of new language features, use of new classes / methods) from the comfort of your own ... workstation.
There is another option that you should consider: Tell Eclipse to generate code for the old Java version (see the compiler options). That way, you can create code that runs on Java 1.3, even if Eclipse uses Java 5.
Not sure what your requirements are, but you could set the compiler level for your projects at the (older) level of your Linux installs. This would cause Eclipse to recompile it at that version, instead of a newer version.
At my company we use IBM's Rational Application Developer (instead of pure Eclipse), but I am assuming the option is in the same spot. If you right-click on your project, you can go to the Java Compiler options and then set the compatibility to the level of that on Linux (1.3, 1.4, etc.).
Since compile Java byte-code is supposed to be portable (for the most part), this should get you past most of your problems.
Otherwise, the other option is to use something like Ant or Maven scripts (which can be kicked off by Eclipse) and then just use a property to set the compiler right before you run it. This way you don't have to switch properties on your projects all the time, if you truly do need "newer" compiled code and can't live with "older" code on both systems.