0

I was creating a new Codenameone project and when I tried running it throws the following error :

java.net.URISyntaxException: Illegal character in path at index 27: file:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar
    at java.net.URI$Parser.fail(URI.java:2848)
    at java.net.URI$Parser.checkChars(URI.java:3021)
    at java.net.URI$Parser.parseHierarchical(URI.java:3105)
    at java.net.URI$Parser.parse(URI.java:3053)
    at java.net.URI.<init>(URI.java:588)
    at java.net.URL.toURI(URL.java:953)
    at com.codename1.impl.javase.JavaFXLoader.addToClassPath(JavaFXLoader.java:296)
    at com.codename1.impl.javase.JavaFXLoader.addJavaFXToClassPath(JavaFXLoader.java:221)
    at com.codename1.impl.javase.JavaFXLoader.runWithJavaFX(JavaFXLoader.java:244)
    at com.codename1.impl.javase.JavaFXLoader.main(JavaFXLoader.java:323)
    at com.codename1.impl.javase.Executor.main(Executor.java:113)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.codename1.impl.javase.Simulator.main(Simulator.java:85)
Exception in thread "AWT-EventQueue-0" java.lang.UnsupportedClassVersionError: javafx/scene/media/MediaException has been compiled by a more recent version of the Java Runtime (class file version 54.0), this version of the Java Runtime only recognizes class file versions up to 52.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at com.codename1.impl.javase.JavaFXLoader$1.loadClass(JavaFXLoader.java:307)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at com.codename1.impl.ImplementationFactory.createImplementation(ImplementationFactory.java:69)
    at com.codename1.ui.Display.init(Display.java:489)
    at com.codename1.impl.javase.Executor$3.run(Executor.java:245)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

I also noticed that theme.res Any Idea what I am missing here?

erluxman
  • 18,155
  • 20
  • 92
  • 126

1 Answers1

1

Story :

This was a silly mistake (not so mistake but lack of information) while creating the project. I am not sure if it's easy to fix the project without recreating it(I tried changing the Java version from project structure in IntelliJ as well as from build.xml but didn't work) but if you are creating a new project, create the project with java version 11 (As I am not sure if it work with higher versions).

The reason was that codename has been compiled with a higher version of Java than I was initially selected in new Project window.

Solution :

Select java_version 11 while creating a new Codenameone project.

enter image description here

erluxman
  • 18,155
  • 20
  • 92
  • 126
  • 2
    This is due to the mess Oracle created with JavaFX. OpenJDK 8 doesn't include JavaFX so for JDK 8 we only support the Oracle VM. JDK 11 should work for everything. All the JDKs in the middle don't work because Oracle released JavaFX libraries compiled for a newer VM. – Shai Almog Dec 10 '19 at 02:10