INCLUIR DLL NO *.JAR DO INTELLIJ IDEA
Answered
Boa tarde galera,
Eu estou tentando gerar um *.JAR de uma aplicação no IntelliJ Idea de impressão de cheques que utiliza comunicação de porta serial. Eu faço isso através do Build > Build Artifacts..., eu consigo gerar o *.JAR, no entanto quando faço o teste com esse *.JAR que foi gerado, a aplicação não consegue se comunicar com a impressora serial.
DETALHE: Quando executo apertando "Run" ou no modo "Debug", a comunicação funciona perfeitamente.
Só pude deduzir que faltam as DLL's, alguem sabe como faço para incluir DLL's no IntelliJ Idea?
Please sign in to leave a comment.
.dll must be in PATH or in a folder that is referenced via -Djava.library.path= JVM option.
Using .dll from inside the jar is possible, but will need to write the code that unpacks it: http://stackoverflow.com/a/4764387/104891.
If you decide to go this route, modify the artifact to include the .dll in the desired location so that your code can unpack and load it: http://www.jetbrains.com/idea/webhelp/configuring-artifacts.html.
Thanks! I've solved part of the problem just debugging my JAR file via command prompt but then I got this error:
The problem here it's that I already changed my JDK to 32 bits, I went in "Project Structure" > "SDK" and I changed the location of the JDK to C:\Program Files (x86)\Java. How do I do to not catch this error again? =/
Sorry for the english :(
Make sure 32-bit JDK is used to run the project.
If you run externally, outside of IDEA, make sure that 32-bit JDK is the first in PATH. You can just uninstall 64-bit JDK and leave only 32-bit version to avoid problems.
Or you can bundle different dll versions with your app and unpack/load the one depending on JDK version that was used to run your app.
It's working! =D
I did what you suggest, I unistalled my 64-bits JDK and just to be sure I installed the 32-bits JDK again! I can't believe that I spent almost two days to solve the problem. =(
And now it's time for testing! Thank you!!!