How can I get the "Eclipse >Generate>Jaxb classes" option back?

Viewed 105324

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.

10 Answers

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.

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!

Related