Go to Post Watch out world, FIRST is going to become mainstream! - Church [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 19-01-2016, 11:48
codedr codedr is offline
Registered User
FRC #0537
Team Role: Mentor
 
Join Date: Mar 2010
Rookie Year: 2009
Location: Wisconsin
Posts: 69
codedr will become famous soon enoughcodedr will become famous soon enough
Re: Java "bad class file" issue

Are you compiling with Java-6?
Class file version 52 needs to be compiled with java-8.
Reply With Quote
  #2   Spotlight this post!  
Unread 19-01-2016, 15:35
Ltwolf20 Ltwolf20 is offline
Registered User
FRC #4796
 
Join Date: Jan 2016
Location: Massachusetts
Posts: 9
Ltwolf20 is an unknown quantity at this point
Re: Java "bad class file" issue

Quote:
Originally Posted by codedr View Post
Are you compiling with Java-6?
Class file version 52 needs to be compiled with java-8.
I'm not sure, I'm a little new to Java. How would I check that?
Reply With Quote
  #3   Spotlight this post!  
Unread 19-01-2016, 20:18
codedr codedr is offline
Registered User
FRC #0537
Team Role: Mentor
 
Join Date: Mar 2010
Rookie Year: 2009
Location: Wisconsin
Posts: 69
codedr will become famous soon enoughcodedr will become famous soon enough
Re: Java "bad class file" issue

On mac in a terminal window, type
echo $JAVA_HOME
javac -version

On windows in a cmd window, type
echo %JAVA_HOME%
javac -version

It will return something like this:
javac -version
javac 1.6.0_33
Reply With Quote
  #4   Spotlight this post!  
Unread 19-01-2016, 21:50
Ltwolf20 Ltwolf20 is offline
Registered User
FRC #4796
 
Join Date: Jan 2016
Location: Massachusetts
Posts: 9
Ltwolf20 is an unknown quantity at this point
Re: Java "bad class file" issue

Quote:
Originally Posted by codedr View Post
On mac in a terminal window, type
echo $JAVA_HOME
javac -version

On windows in a cmd window, type
echo %JAVA_HOME%
javac -version

It will return something like this:
javac -version
javac 1.6.0_33
I get javac 1.8.0_71
Reply With Quote
  #5   Spotlight this post!  
Unread 19-01-2016, 22:31
codedr codedr is offline
Registered User
FRC #0537
Team Role: Mentor
 
Join Date: Mar 2010
Rookie Year: 2009
Location: Wisconsin
Posts: 69
codedr will become famous soon enoughcodedr will become famous soon enough
Re: Java "bad class file" issue

Open this file in an editor,
/Users/ProgrammingWolf/wpilib/java/current/ant/build.xml
and look for the javac stanza, and see if there is specifications for either source= or target= or both. For wpilib.jar you are going to need a value for 1.8 for both.
Reply With Quote
  #6   Spotlight this post!  
Unread 19-01-2016, 23:58
Ltwolf20 Ltwolf20 is offline
Registered User
FRC #4796
 
Join Date: Jan 2016
Location: Massachusetts
Posts: 9
Ltwolf20 is an unknown quantity at this point
Re: Java "bad class file" issue

Quote:
Originally Posted by codedr View Post
Open this file in an editor,
/Users/ProgrammingWolf/wpilib/java/current/ant/build.xml
and look for the javac stanza, and see if there is specifications for either source= or target= or both. For wpilib.jar you are going to need a value for 1.8 for both.
Not sure if I actually went to the right place but here is what I get.


<?xml version="1.0" encoding="UTF-8"?>

<project name="FRC Deployment" default="deploy">

<!--
The following properties can be defined to override system level
settings. These should not be touched unless you know what you're
doing. The primary use is to override the wpilib version when
working with older robots that can't compile with the latest
libraries.
-->

<!-- By default the system version of WPI is used -->
<!-- <property name="version" value=""/> -->

<!-- By default the system team number is used -->
<!-- <property name="team-number" value=""/> -->

<!-- By default the target is set to 10.TE.AM.2 -->
<!-- <property name="target" value=""/> -->

<!-- Any other property in build.properties can also be overridden. -->

<property file="${user.home}/wpilib/wpilib.properties"/>
<property file="build.properties"/>
<property file="${user.home}/wpilib/java/${version}/ant/build.properties"/>

<import file="${wpilib.ant.dir}/build.xml"/>

</project>
Reply With Quote
  #7   Spotlight this post!  
Unread 20-01-2016, 08:28
codedr codedr is offline
Registered User
FRC #0537
Team Role: Mentor
 
Join Date: Mar 2010
Rookie Year: 2009
Location: Wisconsin
Posts: 69
codedr will become famous soon enoughcodedr will become famous soon enough
Re: Java "bad class file" issue

The error message means the java compiler is in version 1.6 mode and you need it to be in the version 1.8 mode.

According to your compiler output, the failure occurred at line 71 of the file, viz last line of the error log you posted. The file you posted doesn't have 71 lines.

Perhaps the IDE you are using is setting the java compiler version?
Reply With Quote
  #8   Spotlight this post!  
Unread 20-01-2016, 12:39
Ltwolf20 Ltwolf20 is offline
Registered User
FRC #4796
 
Join Date: Jan 2016
Location: Massachusetts
Posts: 9
Ltwolf20 is an unknown quantity at this point
Re: Java "bad class file" issue

Quote:
Originally Posted by codedr View Post
The error message means the java compiler is in version 1.6 mode and you need it to be in the version 1.8 mode.

According to your compiler output, the failure occurred at line 71 of the file, viz last line of the error log you posted. The file you posted doesn't have 71 lines.

Perhaps the IDE you are using is setting the java compiler version?
How would I fix this problem? Or check that issue?
Reply With Quote
  #9   Spotlight this post!  
Unread 21-01-2016, 08:42
codedr codedr is offline
Registered User
FRC #0537
Team Role: Mentor
 
Join Date: Mar 2010
Rookie Year: 2009
Location: Wisconsin
Posts: 69
codedr will become famous soon enoughcodedr will become famous soon enough
Re: Java "bad class file" issue

You could look through the build xml files for the strings target= and source= in a javac xml stanza.
or
You could tell how to get a copy of the source files you trying to compile or zip them up and upload them to CD so we can see them too.
Reply With Quote
  #10   Spotlight this post!  
Unread 21-01-2016, 20:11
Ltwolf20 Ltwolf20 is offline
Registered User
FRC #4796
 
Join Date: Jan 2016
Location: Massachusetts
Posts: 9
Ltwolf20 is an unknown quantity at this point
Re: Java "bad class file" issue

Quote:
Originally Posted by codedr View Post
You could look through the build xml files for the strings target= and source= in a javac xml stanza.
or
You could tell how to get a copy of the source files you trying to compile or zip them up and upload them to CD so we can see them too.
Do you think I could fix this through uninstalling an reinstalling eclipse and all related files?
Reply With Quote
  #11   Spotlight this post!  
Unread 22-01-2016, 20:50
codedr codedr is offline
Registered User
FRC #0537
Team Role: Mentor
 
Join Date: Mar 2010
Rookie Year: 2009
Location: Wisconsin
Posts: 69
codedr will become famous soon enoughcodedr will become famous soon enough
Re: Java "bad class file" issue

I doubt re-installing eclipse is going to fix compiling instructions that are contained within the source code that you are trying to compile.
Reply With Quote
  #12   Spotlight this post!  
Unread 23-01-2016, 10:37
Ltwolf20 Ltwolf20 is offline
Registered User
FRC #4796
 
Join Date: Jan 2016
Location: Massachusetts
Posts: 9
Ltwolf20 is an unknown quantity at this point
Re: Java "bad class file" issue

target="${ant.java.version}"
source="${ant.java.version}"

Is what I get when I look at the build.xml files
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 10:18.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi