-2

i have java 2 SDK standard edition ve 1.4.2-06 and i compile a java program that use the classes in a jar called Visad after extracting the contents of the jar I have a folder called Visad also contains subfolders of classes. I compile my program and I always receive this error message

cannot access visad.java3d.DisplayImplJ3D bad class file .\visad\java3d\DisplayImplJ3D.class 
class file has wrong version 50.0 should be 48.0 
please remove or make sure it appears in the correct subdirectory of the classpath

i read that maybe the problem is the version of my java which is different from the compiled classesin jar , i d'ont know what to do

thanks

blackbishop
  • 30,945
  • 11
  • 55
  • 76
  • Why you have 2 JDKs? What versions are they? Which JDK you use to compile and which JRE to run? – m0skit0 Aug 18 '14 at 13:01
  • possible duplicate of [Exception while compiling: wrong version 50.0, should be 49.0](http://stackoverflow.com/questions/1766216/exception-while-compiling-wrong-version-50-0-should-be-49-0) – Boann Aug 18 '14 at 13:05
  • 1
    If you are going to use a historical version of of Java like 1.4, 5.0 or 6, you should at least have the latest update of that JDK for that version. – Peter Lawrey Aug 18 '14 at 13:28

2 Answers2

2

It seems you are using java compiler of version 1.4 with classes that have been compiled for 1.5 or 1.6

You should change your version of java to a newer one... You know that we are running java 8 now?

You should download and install java SE 8 http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Gcc
  • 21
  • 1
0
cannot access visad.java3d.DisplayImplJ3D bad class file .\visad\java3d\DisplayImplJ3D.class 
class file has wrong version 50.0 should be 48.0 

The part of the error message "class file has wrong version 50.0" tells that the class file DisplayImplJ3D.class was created using a JDK 1.6 and your are using a javac compiler from JDK 1.4 "should be 48.0".

  • if you must stick on JDK 1.4 you need a Visad.jar which was compiled with Java 1.4
  • if there is no constraint to stick on JDK 1.4 you should update at least to JDK 1.6 and compile your source

edit your could also download the Visad source Visad homepage and compile it with your JDK

HOWTO build VisAD with JDK 1.4

  • download the VisAD source and extract it to your prefered destination
  • download and install Java 3D API for JDK 1.4 from Java 3D API, during the installation check where the *.jar file will be installed
  • cd into the VisAD source directory
  • run ant build jar
  • if the build fails with error: package javax.media.j3d does not exist then you must copy the necessary Jar files manually from the installation directory (you had to remember during the installation)
  • copy the files j3dcore.jar, j3dutils.jar and vecmath.jar to your VisAD source directory
  • amend the build.xml, add the bold part

    <javac srcdir="." memoryMaximumSize="512M" fork="true" debug="on" classpath=".;j3dcore.jar;j3dutils.jar;vecmath.jar" />

  • run ant build jar

  • if the build was successful there should be a visad.jar in the VisAD source directory
SubOptimal
  • 22,518
  • 3
  • 53
  • 69
  • i installed java 2 SDK SE ve 1.4.2-06 bcause i need it to install Java3d-1_3_1-windowsi586-opengel. – user3697150 Aug 18 '14 at 14:47
  • when i get visad_src and i unpack it i have subfolders and i don't know how i can compile classes Inside subfolders – user3697150 Aug 18 '14 at 14:50
  • You should rather use the latest version of Java 3D which is a lot less painful to install (with a more recent JDK) and still compatible with the old versions as the public API remains unchanged: http://tinyurl.com/cf47kcb – gouessej Sep 07 '14 at 11:47