• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Error with Javac (class version error)

 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
am getting the following error when using 'ant compile' command:

java.lang.UnsupportedClassVersionError: com/sun/tools/javac/Main (Unsupported major.minor version 48.0).

whats this major.minor? whats this version 48.0??

I thought problem with PATH settings and pointin to two differant JRE versions. I checked PATH and CLASSPATH, they are pretty good.

Again, I had set the classpath in build file like:
<javac srcdir="src" destdir="build/classes" debug="on">
<classpath>
<fileset dir="C:\j2sdk1.4.0_03\lib" >
<include name="**/*.jar" />
</fileset>
</classpath>
</javac>
Now alos its not working.

Plsssssss clear me whats this major/minor and 48.0, what I need to resolve this??
Thanks.
 
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Perhaps running ant with -v will help.

48.0 refers to classes compiled - 1.4
49.0 refers to classes compiled - 1.5 aka 5.0

So, if you're getting an error that 48.0 isn't supported it sounds like an earlier version complaining (1.3 or earlier).

Are you including all the jars in jdk/lib directory in your classpath for a particular reason? That isn't usually necessary.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if included "tools.jar" in CLASSPATH hope it is from the same java of JAVA_HOME, PATH.
ex. for 1.4
C:\j2sdk1.4.2_04\lib\tools.jar - CLASSPATH
C:\j2sdk1.4.2_04\bin - PATH
C:\j2sdk1.4.2_04 - JAVA_HOME
 
Saloon Keeper
Posts: 28108
198
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ant or no ant, you don't/shouldn't include jars from a JAVA_HOME/lib directory explicitly to javac. They come in automagically.

I think that you are referring to the libs from a different version of Java than the one that's being used by your compiler, but it may be that Java is annoyed because you're disrupting the normal classpath rules and thereby getting hit by the classloader.
 
Destiny's powerful hand has made the bed of my future. And this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic