How can I get the “Eclipse >Generate>Jaxb classes”

2019-01-23 11:25发布

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.

9条回答
萌系小妹纸
2楼-- · 2019-01-23 11:51

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.

查看更多
放荡不羁爱自由
3楼-- · 2019-01-23 11:55

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.

查看更多
手持菜刀,她持情操
4楼-- · 2019-01-23 11:55

you may download JAXB Eclipse Plug-In

jaxb eclipse plugin

查看更多
登录 后发表回答