Results 1 to 5 of 5
  1. #1
    mrd15 is offline Member
    Join Date
    Mar 2014
    Posts
    3
    Rep Power
    0

    Default Problem with openCSV when creating JAR file

    Hello all,

    I'm having a problem with using the openCSV library when I create a JAR file. I'm currently using BlueJ to run my code. When I compile my program in there, I have no problems whatsoever and it runs great, yet when I create my program into a JAR file, my application doesn't work.

    I would think that my problem is either stemming from faulty exception handling, although I don't understand why an input would work in the BlueJ environment, but not when using the JAR file. Or, perhaps the openCSV library isn't in a correct class path(I don't know if this is correct terminology).

    I would appreciate any help, if you need more information about my code or anything please let me know. Thanks!

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,516
    Rep Power
    25

    Default Re: Problem with openCSV when creating JAR file

    my application doesn't work.
    Can you explain?
    What error messages do you get? Copy the full text and paste it here.
    To see any error messages, open a command prompt window, change to the directory with the jar file and enter:
    java -jar THEJARFILENAME.jar
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    mrd15 is offline Member
    Join Date
    Mar 2014
    Posts
    3
    Rep Power
    0

    Default Re: Problem with openCSV when creating JAR file

    Essentially, I use the openCSV to transfer data from a csv file (contains elements of the periodic table, with atomic numbers and masses) to an array object that I have created in a class, that stores all the information. In this class, I also have methods to search through the array to find and retrieve information.
    I have another class that creates a GUI. The GUI has a Jframe that allows the user to enter the name/element symbol and the program outputs the selected elements information to the user.

    This all works well inside BlueJ when I run it, but when I turn my application into a JAR file, the element search function ceases to work. I can type into the input line, but nothing happens after I press "enter". Everything else in the GUI shows up fine and dandy, though.

    I don't receive any error messages in BlueJ, terminal gave me these though….

    Exception in thread "main" java.lang.UnsupportedClassVersionError: Chemistry_Helper : Unsupported major.minor version 51.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader. java:637)
    at java.lang.ClassLoader.defineClass(ClassLoader.java :621)
    at java.security.SecureClassLoader.defineClass(Secure ClassLoader.java:141)
    at java.net.URLClassLoader.defineClass(URLClassLoader .java:283)
    at java.net.URLClassLoader.access$000(URLClassLoader. java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java: 197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.j ava:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:3 06)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launche r.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:2 47)

  4. #4
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,516
    Rep Power
    25

    Default Re: Problem with openCSV when creating JAR file

    Exception in thread "main" java.lang.UnsupportedClassVersionError: Chemistry_Helper : Unsupported major.minor version 51.0
    That means that the java program used to execute the class is a different version and older than the javac program that created the class file.

    The javac command has options to create class files for older java versions. See the API doc for the javac command.
    If you don't understand my response, don't ignore it, ask a question.

  5. #5
    mrd15 is offline Member
    Join Date
    Mar 2014
    Posts
    3
    Rep Power
    0

    Default Re: Problem with openCSV when creating JAR file

    Quote Originally Posted by Norm View Post
    That means that the java program used to execute the class is a different version and older than the javac program that created the class file.

    The javac command has options to create class files for older java versions. See the API doc for the javac command.
    Thank you!

Similar Threads

  1. Replies: 10
    Last Post: 09-13-2013, 08:41 PM
  2. Problem creating a jar file
    By nathan1 in forum NetBeans
    Replies: 2
    Last Post: 05-28-2013, 07:08 AM
  3. Replies: 2
    Last Post: 05-26-2011, 05:38 AM
  4. Problem in creating a file
    By Tulsa in forum New To Java
    Replies: 1
    Last Post: 02-16-2011, 08:21 PM
  5. Problem creating a Post script file
    By krishnan.1000 in forum New To Java
    Replies: 0
    Last Post: 02-14-2008, 07:15 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •