0

I'd like to create POJOs from a reasonably complex JSON schema that references types within itself, and the web interface has known issues doing this that are apparently fixed for offline use. I'm running on Win7, and the output from java -version is

  java version "1.7.0_79"
  Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
  Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

The simplest offline mechanism is CLI, so I've downloaded the current version, extracted it to a folder (no spaces in the path, though I assume that's not an issue anyway) and tried getting the help output with jsonschema2pojo --help. I get

Exception in thread "main" java.lang.NoClassDefFoundError: org/jsonschema2pojo/GenerationConfig
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
        at java.lang.Class.getMethod0(Unknown Source)
        at java.lang.Class.getMethod(Unknown Source)
        at sun.launcher.LauncherHelper.getMainMethod(Unknown Source)
        at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.jsonschema2pojo.GenerationConfig
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 6 more

I'm in the same directory as the .jar files that came out of the package. I've also tried firing the appropriate .jar directly with java -jar jsonschema2pojo-cli-0.4.13.jar --help and get the same response. I've also tried running in an administrator shell just in case.

So at the moment it can't even start up, so there's little point trying to go further with it.

Is anyone else using this from the commandline? On Win7?

Craig Graham
  • 1,161
  • 11
  • 35

1 Answers1

0

Appears to be working ok for me with this java version:

C:\temp\json\jsonschema2pojo-0.4.13>java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

Running jsonschema2pojo.bat --help or java -jar jsonschema2pojo-cli-0.4.13.jar --help gives a list of options as expected.

Do you have jsonschema2pojo-core-0.4.13.jar in the lib folder (along with 23 other jars)?

Mat
  • 66
  • 7
  • This does not really answer the question, where Java 7 is requested. – Uwe Allner Jul 07 '15 at 11:45
  • I realise the java versions don't match but I don't think it's the version of Java that's the issue, I think the jar(s) is missing. I also wanted to see/show that jsonschema2pojo isn't completely broken. – Mat Jul 07 '15 at 11:50
  • Yeah, crucial bit was mentioning the 23 other jars- thanks. I'd missed the lib folder and thought it was made up of just the 4 jars in the root dir. I wasn't specifically requesting that version of Java, just thought it could have been an issue. I did consider including a directory listing but thought it too trivial :) – Craig Graham Jul 07 '15 at 11:57