Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

how to use java libraries in unity (not for android)

Discussion in 'Immediate Mode GUI (IMGUI)' started by Minsc, Jan 1, 2016.

  1. Minsc

    Minsc

    Joined:
    Dec 30, 2013
    Posts:
    39
    Hi there,

    I would like to use a java library in Unity, when I did a test with a very simple program that required only "Java dependencies" I just converted the .jar into a .dll with ikvm, put the ikvm dlls and the generated dll in the Assets folder and it worked. However when I try to convert a .jar file in which my code uses external libraries, the ikvm option is not possible because these external libraries are not found, and if i try to convert them to dll first ikvm doesn't find the dependencies of these libraries, so it becomes quite a maze of dependencies.
    How can I do to use in another way a jar file in Unity? Please not that this is not for an android application.

    Thanks for your help and happy new year
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    It's not possible; Unity doesn't use Java. You can use .NET dlls, or native code plugins.

    --Eric
     
  3. Minsc

    Minsc

    Joined:
    Dec 30, 2013
    Posts:
    39
    But can the native code plugins use java?
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    No, they must be native code (machine code, such as compiled by C++). Java isn't native code.

    --Eric
     
  5. Minsc

    Minsc

    Joined:
    Dec 30, 2013
    Posts:
    39
    Ok I see, thanks for your help ;)