+ Reply to Thread
Results 1 to 7 of 7

Thread: erorr buid .jar file on eclipse

  1. #1
    Senior Member
    Join Date
    May 2012
    Posts
    144
    Thanks
    2
    Thanked 0 Times in 0 Posts

    erorr buid .jar file on eclipse

    Hi

    I am developing client java (Destop java). I am run it on eclipse is good.
    But when I buid it to .jar file by eclipse and run it with command java -jar robot.jar.

    I see some error:

    Exception in thread "main" java.lang.NoClassDefFoundError: com/electrotank/elect
    roserver5/client/api/helper/EsMessage
    at controller.MainLiengClient.createBotAutoLiengs(Mai nLiengClient.java:6
    6)
    at controller.MainLiengClient.main(MainLiengClient.ja va:105)
    Caused by: java.lang.ClassNotFoundException: com.electrotank.electroserver5.clie
    nt.api.helper.EsMessage
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 2 more

    --> Please, fix it help me

  2. #2
    Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,212
    Thanks
    80
    Thanked 1,086 Times in 1,075 Posts
    When I make my desktop Java clients, I copy the entire lib folder that I use for compiling to the same location as my jar file (so that I see the lib folder there and all the jars are in it except the project jar. Try that.
    Teresa Carrigan
    Senior Engineer
    Electrotank, Inc.

  3. #3
    Senior Member
    Join Date
    May 2012
    Posts
    144
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by tcarr View Post
    When I make my desktop Java clients, I copy the entire lib folder that I use for compiling to the same location as my jar file (so that I see the lib folder there and all the jars are in it except the project jar. Try that.
    I follow you. I still see same error. Please, help me. I can not run .jar file

  4. #4
    Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,212
    Thanks
    80
    Thanked 1,086 Times in 1,075 Posts
    Does the client work when run inside Eclipse?

    Does the client use loadAndConnect? If so then it needs to have the settings.xml file where it can find it.

    If you double-click on the jar for the Java client for SimpleChat (ElectroServer_5_3_3\code_examples\SimpleChat\clie nt\java\bin\SimpleChat.jar), does that work? If not then you need to tell your operating system that the .jar extension needs to be associated with "Java Platform SE Binary".

    I've made quite a few Java desktop apps, but I used NetBeans.
    Teresa Carrigan
    Senior Engineer
    Electrotank, Inc.

  5. #5
    Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,212
    Thanks
    80
    Thanked 1,086 Times in 1,075 Posts
    Rereading the original post, the bug is definitely that Java isn't finding the ES5 Java api jar.
    Teresa Carrigan
    Senior Engineer
    Electrotank, Inc.

  6. #6
    Senior Member
    Join Date
    May 2012
    Posts
    144
    Thanks
    2
    Thanked 0 Times in 0 Posts
    I already built jar file by Netbean or using ant file. I run it on eclipse is okie. But using eclipse to buit it is error. Thank you so much!

  7. #7
    Administrator tcarr's Avatar
    Join Date
    Dec 2007
    Posts
    7,212
    Thanks
    80
    Thanked 1,086 Times in 1,075 Posts
    If I understand you correctly, your project works just fine if you build using NetBeans or using Ant. It runs from inside Eclipse just fine. Eclipse just doesn't build the correct jar for you that will work on your desktop.

    If this is correct then the problem is with Eclipse or with the project settings in Eclipse, not with ES5. Googling turned up a suggestion on StackOverflow to check your Eclipse run configurations to see if something is set correctly in running from the IDE but not in running outside the IDE.

    That's about all I can help you with on this, since it's not an ES5 issue and since you already have two workarounds available (using NetBeans, using Ant).
    Teresa Carrigan
    Senior Engineer
    Electrotank, Inc.

+ Reply to Thread

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