I do not believe this is a duplicate as I have been unable to find a solution that works here on stackoverflow and other sites/forums. I list everything that I have tried and did not work below.
I am trying to run the command "sencha app build native" in terminal on OSX El Capitain and I run into the following error.
Sencha Cmd v6.1.3.42
[INF] Using GPL version of Sencha Touch version 2.3.0 from /Users/myuser/Downloads/MyProject_2/touch.
[INF] The implications of using GPL version can be found here (http://www.sencha.com/products/extjs/licensing).
[INF] Processing Build Descriptor : native
[INF] Loading app json manifest...
[INF] Writing output to file /Users/myuser/Downloads/MyProject_2/build/temp/production/MyProject/sencha-compiler/cmd-packages.js
[INF] writing content to /Users/myuser/Downloads/MyProject_2/bootstrap.js
[INF] appending content to /Users/myuser/Downloads/MyProject_2/bootstrap.js
[INF] appending content to /Users/myuser/Downloads/MyProject_2/bootstrap.js
[INF] appending content to /Users/myuser/Downloads/MyProject_2/bootstrap.js
[INF] Appending content to /Users/myuser/Downloads/MyProject_2/bootstrap.json
[WRN] C1014: callParent has no target (me.callParent in Ext.dataview.DataView.onAfterRender) -- /Users/myuser/Downloads/MyProject_2/touch/src/dataview/DataView.js:892
[WRN] C1014: callParent has no target (this.callParent in Ext.Decorator.setDisabled) -- /Users/myuser/Downloads/MyProject_2/touch/src/Decorator.js:157
[WRN] C1014: callParent has no target (this.callParent in Ext.data.ArrayStore.loadData) -- /Users/myuser/Downloads/MyProject_2/touch/src/data/ArrayStore.js:64
[WRN] C1014: callParent has no target (this.callParent in Ext.fx.animation.Wipe.getData) -- /Users/myuser/Downloads/MyProject_2/touch/src/fx/animation/Wipe.js:119:7
[INF] Writing concatenated output to file /Users/myuser/Downloads/MyProject_2/cordova/www/app.js
[INF] merging 0 input resources into /Users/myuser/Downloads/MyProject_2/cordova/www/resources
[INF] merged 0 resources into /Users/myuser/Downloads/MyProject_2/cordova/www/resources
[INF] merging 46 input resources into /Users/myuser/Downloads/MyProject_2/cordova/www
[INF] merged 0 resources into /Users/myuser/Downloads/MyProject_2/cordova/www
[INF] writing content to /Users/myuser/Downloads/MyProject_2/sass/example/bootstrap.js
[INF] appending content to /Users/myuser/Downloads/MyProject_2/sass/example/bootstrap.js
[INF] appending content to /Users/myuser/Downloads/MyProject_2/sass/example/bootstrap.js
[INF] appending content to /Users/myuser/Downloads/MyProject_2/sass/example/bootstrap.js
[INF] appending content to /Users/myuser/Downloads/MyProject_2/sass/example/bootstrap.js
[ERR]
[ERR] BUILD FAILED
[ERR] java.lang.UnsupportedClassVersionError: com/sencha/core/functional/Action : Unsupported major.minor version 51.0
[ERR] at com.sencha.command.BasePluginCommands$BasePluginCom
[ERR] mand.dispatch(BasePluginCommands.java:260)
[ERR]
[ERR] Total time: 7 seconds
[ERR] The following error occurred while executing this line:
/Users/myuser/Downloads/MyProject_2/.sencha/app/build-impl.xml:285: The following error occurred while executing this line:
/Users/myuser/Downloads/MyProject_2/.sencha/app/sass-impl.xml:310: The following error occurred while executing this line:
/Users/myuser/Downloads/MyProject_2/.sencha/app/sass-impl.xml:316: com.sencha.exceptions.BasicException: com/sencha/core/functional/Action : Unsupported major.minor version 51.0
The error tells me that there is something wrong with my java setup but I can't figure out what. Checking my version in terminal shows the following.
$ java -version java version "1.8.0_101" Java(TM) SE Runtime Environment (build 1.8.0_101-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
Opening up java via System preferences shows only one Java version installed which is 1.8 with install path at '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java'
Running '/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version' in terminal also shows version 1.8
Running '/usr/bin/java -version' also gives version 1.8
I have tried adding variations of these 3 lines in order to try to solve the issue but it doesn't seem to change anything. As you can see I also tried changing the memory just in case it might have been a memory issue
ANT_OPTS="-Xms1024m -Xmx2048m"
export PATH="/usr/local/bin:$PATH"
export JAVA_HOME="/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java"
I also tried running 'sencha app build -c' which gives the same error.
I also tried adding the following to sencha.cfg to see if it might help
cmd.jvm.args=-Xms512m -Xmx2048m
I also tried installing this update from apple https://support.apple.com/kb/dl1572 which says that it installs an older version of Java 6 runtime
I also tried installing java sdk 7 and java sdk 8 to see if that helped, no luck
What else can I try doing in order to fix the error "Unsupported major.minor version 51.0" relating to Sencha builds
I finally solved this by changing my JAVA_HOME variable to "/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home"
I put the following in .bashrc and .bash_profile making sure to remove anything else related to java or the JAVA_HOME variable. You can use a command like 'nano /Users/$USER/.bash_profile' to edit the file
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home"
export PATH=$JAVA_HOME/bin:$PATH
Type 'echo $JAVA_HOME' in terminal to make sure you set the right path.
Then restart your mac and try running the 'sencha app build native' command again and it should work or throw a different error (at least its progress)
Note that you will need to install jdk 1.7 before doing this, download it here http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
Your version may be different from mine so open terminal and type 'cd /Library/Java/JavaVirtualMachines/' to switch directories and then type 'ls -la' to list all the files you have there. You should see a file named jdk1.7.0_XX.jdk