Java 从命令行进行Hibernate SchemaExport

Java 从命令行进行Hibernate SchemaExport,java,hibernate,schemaexport,Java,Hibernate,Schemaexport,我是hibernate新手,一直在尝试从命令行(windows)运行SchemaExport hdm2ddl工具,如下所示: java-cp“lib/*”org.hibernate.tool.hbm2ddl.SchemaExport--config=src/hibernate.cfg.xml--create src/hello/Message.hbm.xml 我的目录结构如下: - HelloWorld - bin - lib (all of the required jars

我是hibernate新手,一直在尝试从命令行(windows)运行SchemaExport hdm2ddl工具,如下所示:
java-cp“lib/*”org.hibernate.tool.hbm2ddl.SchemaExport--config=src/hibernate.cfg.xml--create src/hello/Message.hbm.xml

我的目录结构如下:

- HelloWorld
    - bin
    - lib (all of the required jars - list omitted for brevity)
    - src
        - hello (HelloWorld.java, Message.java & Message.hbm.xml)
        - persistence (HibernateUtil.java)
        - hibernate.cfg.xml
        - log4j.properties
尝试运行该命令会产生以下错误:

log4j:WARN No appenders could be found for logger (org.jboss.logging).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
org.hibernate.internal.util.config.ConfigurationException: Could not locate cfg.xml resource [src/hibernate.cfg.xml]
        at org.hibernate.boot.cfgxml.internal.ConfigLoader.loadConfigXmlResource(ConfigLoader.java:53)
        at org.hibernate.boot.registry.StandardServiceRegistryBuilder.configure(StandardServiceRegistryBuilder.java:163)
        at org.hibernate.tool.hbm2ddl.SchemaExport.buildStandardServiceRegistry(SchemaExport.java:579)
        at org.hibernate.tool.hbm2ddl.SchemaExport.main(SchemaExport.java:546)
到目前为止,我的研究:

  • 该命令找不到hibernate.cfg.xml文件。将命令中文件的拼写更改为错误拼写会产生相同的错误
  • 将cfg.xml文件复制到classpath(lib)和HelloWorld目录中。错误依然存在
  • 这基本上是“带Hibernate的Java持久化”中的示例,但是从命令行运行它,而不是使用ant