I am trying to export my Java Application to Mac. The application is based on Compiler Complience Level 1.7. I tried different methods to bundle the application.
1) Eclipse. The latest version of JVM that I can use to export on Eclipse is 1.6*.
2) Maven. It looks like on Maven also the same problem exists. As when I used following command it showed a version related error.
System:
~Jack$ java -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode).
Maven method
Maven Command
mvn package osxappbundle:bundle -DmainClass=com.example.Main
Errors that Maven returns
type javax.swing.JList does not take parameters
and
cannot access org.json.JSONArray
bad class file: org/json/JSONArray.class(org/json:JSONArray.class)
class file has wrong version 52.0, should be 50.0
*I know these errors are related to the version of Java. My compiler is 1.7 but when I use maven to bundle it, above errors will be shown.
Eclipse method
Version: Luna Service Release 1a (4.4.1)
What should I do? I could find other alternatives like JarBundler but did not work.
There are two different kinds of Java app bundle on OSX. The older kind works with Apple Java versions (up to Java 6) and the newer kind with Oracle Java (7 and later). The maven osxappbundle plugin only supports the former, which is why it won't use Java later than 6. I presume the eclipse tool you're using is the same.
This alternative Maven plugin claims to work with Oracle Java versions.
The new recommended way to create Java application bundles in OS X is to use Oracle's appbundler . This is Ant-based.
There is also a fork which provides some extra functionality.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.