Ant unsupported error wont go away - java

I am getting this error and tried almost everything I could think of.
I even reinstalled Ubuntu, downloaded jdk 5 from Oracle and then installed maven2 and ant 1.8 but all in vain.
I wrote a helloworld 'build.xmland ranant` on it, but I still get the error below.
Just wondering if there is a hidden jar file that is not complied with the right version of compiler.
BUILD FAILED java.lang.UnsupportedClassVersionError: Bad version
number in .class file at java.lang.ClassLoader.defineClass1(Native
Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at
java.net.URLClassLoader.access$100(URLClassLoader.java:56) at
java.net.URLClassLoader$1.run(URLClassLoader.java:195) at
java.security.AccessController.doPrivileged(Native Method) at
java.net.URLClassLoader.findClass(URLClassLoader.java:188) at
java.lang.ClassLoader.loadClass(ClassLoader.java:307) at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268) at
java.lang.ClassLoader.loadClass(ClassLoader.java:300) at
java.lang.ClassLoader.loadClass(ClassLoader.java:252) at
javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:88) at
javax.xml.parsers.FactoryFinder.findJarServiceProvider(FactoryFinder.java:278)
at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:185) at
javax.xml.parsers.SAXParserFactory.newInstance(SAXParserFactory.java:107)
at
org.apache.tools.ant.util.JAXPUtils.newParserFactory(JAXPUtils.java:120)
at
org.apache.tools.ant.util.JAXPUtils.getNSParserFactory(JAXPUtils.java:104)
at
org.apache.tools.ant.util.JAXPUtils.getNamespaceXMLReader(JAXPUtils.java:172)
at
org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:273)
at
org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:178)
at
org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:82)
at org.apache.tools.ant.Main.runBuild(Main.java:793) at
org.apache.tools.ant.Main.startAnt(Main.java:217) at
org.apache.tools.ant.launch.Launcher.run(Launcher.java:280) at
org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)

rg.apache.tools.ant.util.JAXPUtils.newParserFactory(JAXPUtils.java:120)
at
org.apache.tools.ant.util.JAXPUtils.getNSParserFactory(JAXPUtils.java:104)
at
org.apache.tools.ant.util.JAXPUtils.getNamespaceXMLReader(JAXPUtils.java:172)
at
org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:273)
at
org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:178)
at
org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:82)
at org.apache.tools.ant.Main.runBuild(Main.java:793) at
org.apache.tools.ant.Main.startAnt(Main.java:217) at
org.apache.tools.ant.launch.Launcher.run(Launcher.java:280) at
org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
It seems you have wrong version of apache jars in classpath which are not compiled for the jdk runtime you have on machine.

Related

java exceptions while trying to install pycharm in ubuntu

I am gettting the following errors while trying to install pycharm in my ubuntu 14.04 64 bit
Java HotSpot(TM) Server VM warning: ignoring option MaxPermSize=250m; support was removed in 8.0
Start Failed: Internal error. Please report to http://jb.gg/ide/critical-startup-errors
java.lang.reflect.InvocationTargetException
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.intellij.ide.Bootstrap.main(Bootstrap.java:39)
at com.intellij.idea.Main.main(Main.java:101)
Caused by: java.lang.UnsatisfiedLinkError: /opt/jdk/jdk1.8.0_77/jre/lib/i386/libawt_xawt.so: libXext.so.6: cannot open shared object file: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1845)
at java.lang.Runtime.loadLibrary0(Runtime.java:870)
at java.lang.System.loadLibrary(System.java:1122)
at java.awt.Toolkit$3.run(Toolkit.java:1636)
at java.awt.Toolkit$3.run(Toolkit.java:1634)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.loadLibraries(Toolkit.java:1633)
at java.awt.Toolkit.<clinit>(Toolkit.java:1668)
at java.awt.Cursor.<clinit>(Cursor.java:195)
at javax.swing.text.html.HTMLEditorKit.<clinit>(HTMLEditorKit.java:623)
at com.intellij.util.ui.UIUtil.<clinit>(UIUtil.java:97)
at com.intellij.ide.plugins.PluginManager.start(PluginManager.java:72)
... 6 more
Also, an UI exception occurred on attempt to show above message:
java.lang.NoClassDefFoundError: Could not initialize class java.awt.Toolkit
at java.awt.Component.<clinit>(Component.java:593)
at com.intellij.idea.Main.showMessage(Main.java:335)
at com.intellij.idea.Main.showMessage(Main.java:311)
at com.intellij.idea.Main.main(Main.java:104)
i can't figure out why this is happening. Any help on this is appreciated
Could you provide your method of installation?
Are you using the bundled JRE provided in the Ubuntu package?
Apt-get/apt update libXext.so.6 see: Can't find/install libXtst.so.6?
For additional info see:
https://www.jetbrains.com/help/pycharm/2016.1/requirements-for-pycharm.html

How to convert jar file to DMG from windows Operating System

I had Developed Java Application in Windows 7.
And I had made JAR file of that application.
Now I want to convert that File into DMG format which is compatible for MAC Operating System.
Can any one Suggest me steps please?
I tried into terminal But got this errors.
DEVs-MacBook-Proist idev$ java -jar Soul_Spotter.jar
Exception in thread "main" java.lang.UnsupportedClassVersionError: idev/soulspotter/Login : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
The below link explains the steps. I've also copied the answer which worked for me.
Copied from convert java app to mac installer...dmg
Use "Jar Bundler" in the XCode download from Apple Developer
Connection.
http://developer.apple.com/technology/xcode.html
You will need to register for a free account.
Steps: http://www.centerkey.com/mac/java/

Java: Run Program without Eclipse

I made a game that uses external libraries and resource files. Now I want test it on another PC(with Ubuntu OS), I tried to run it without eclipse by exporting to jar files, but it doesn't work. This is the hierarchy. Is there any simple way to do this ?
Edit
When I export it as Runnable(Note that I'm trying to run it still on windows not ubuntu) jar file and try to run it java -jar gra.jar It throws:
`Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoa
der.java:58)
Caused by: java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1860)
at java.lang.Runtime.loadLibrary0(Runtime.java:845)
at java.lang.System.loadLibrary(System.java:1084)
at org.lwjgl.Sys$1.run(Sys.java:73)
at java.security.AccessController.doPrivileged(Native Method)
at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
at org.lwjgl.Sys.loadLibrary(Sys.java:95)
at org.lwjgl.Sys.<clinit>(Sys.java:112)
at org.lwjgl.opengl.Display.<clinit>(Display.java:132)
at org.newdawn.slick.AppGameContainer$1.run(AppGameContainer.java:39)
at java.security.AccessController.doPrivileged(Native Method)
at org.newdawn.slick.AppGameContainer.<clinit>(AppGameContainer.java:36)
at MainWindow.main(MainWindow.java:14)
... 5 more`
Make sure you are getting your resource files correctly, not referencing them in your local file system.
To ensure your resources are put in the JAR add them to your classpath.
Caused by: java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
lwjgl is not found. It should be in one of the directories listed in java.library.path.
You most certainly added a directory to java.library.path with the native dlls of jwgl when you set up your project. Eclipse cannot export this. You will have to create a starter script (sh, bat) which adds the dlls.
Have a look at the last step here:
http://www.lwjgl.org/wiki/index.php?title=Setting_Up_LWJGL_with_Eclipse
How did you pack the jar? If you used solely eclipse, you should use jarsplice. That may fix the error

IncompatibleClassChangeError while running JAXB on Unix AIX

I get a java.lang.IncompatibleClassChangeError when i try to run my project on AIX machine.
The project generate XML files using JAXB API (2.0).
The development environment installed in Windows XP and use JDK1.5.0(the same JDK as AIX machine ones).
In the developement environment the project works good. but in the AIX machine it doesn't work (throws the exception).
Here is the stack trace when I try to run the project :
........................./build.xml:176: java.lang.IncompatibleClassChangeError
at com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl$1.size(ElementPropertyInfoImpl.java:82)
at java.util.AbstractList$Itr.hasNext(AbstractList.java:431)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:260)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:104)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:85)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:214)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:99)
at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:85)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:320)
at com.sun.xml.bind.v2.model.impl.RegistryInfoImpl.<init>(RegistryInfoImpl.java:103)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.addRegistry(ModelBuilder.java:362)
at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:332)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:460)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:298)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:141)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1163)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:145)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:236)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:615)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:186)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:146)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:348)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:446)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:409)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:313)
at gen.utils.Util.unmarshalling(Unknown Source)
at gen.utils.Util.mvtConfig(Unknown Source)
at gen.utils.Util.mvtGenConfig(Unknown Source)
at gen.start.StartGen.mvtGeneration(Unknown Source)
at gen.start.StartGen.start(Unknown Source)
at gen.start.StartGen.main(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:615)
at org.apache.tools.ant.taskdefs.ExecuteJava.run(ExecuteJava.java:217)
at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:152)
at org.apache.tools.ant.taskdefs.Java.run(Java.java:771)
at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:221)
at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:135)
at org.apache.tools.ant.taskdefs.Java.execute(Java.java:108)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:615)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Please help.
Thanks.
Check your classpath on AIX and make sure you are using compatible versions of jaxb-api and jaxb-impl libraries. I have encountered IncompatibleClassChangeError when only the minor version is different by one increment (e.g. 2.2.5 versus 2.2.6).
To check what version of each library you are using and what is required for compatibility, look in the manifest file located in the META-INF directory within each jar file. The jaxb-impl manifest declares (in addition to its own version) the specification-version, which is the version of jaxb-api jar that it requires. Since v2.2.2, the version numbers of compatible instances of jaxb-api and jaxb-impl no longer match: e.g. jaxb-impl v2.2.4 is compatible with jaxb-api v2.2.3
I only have experience using the Sun implementation of JAXB (com.sun.xml.bind), so this might not apply if you are using a different implementation.

Mac OS X tries to launch jar with Java 1.5 although it needs 1.6

I have a Java project which uses Java 1.6. I package a jar, the manifest simply states the Main-Class.
On the Mac, it fails to start since it tries to use 1.5 for it:
Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:676)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:317)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:375)
Can I specify the 1.6 in the jar or do I need to alter the settings on the Mac?
Just start it by calling the correct java runtime from a JDK/JRE 6 installation, if you don't want to change default settings (although I would recommend to switch to Java 6).

Categories