How to add External libaries to jar in intellij - java

to work with mp3 files on my project in Intellij I needed to use mp3spi libary. So I added it to my project libaries and everything works great when I compile my application inside IDE, but, when I build artifact it does not have my external libary inside jar file so it does not read my mp3 file. I also added them to my artifacts output path but maybe I did something wrong. I am stuck, please help.
Project structure screen

Related

How to create jar file in intellij

I am using intellij community version . I am creating a jar file via build artifact but I am getting file size 67357KB . Which is very big .How to create proper jar file .
Thanks in advance
A "proper" JAR file can be very big. So you are probably creating it the right way.
So what you really need to do is to examine the JAR file to see what the build has put into it. If there is stuff in the JAR that shouldn't be there, you then need to look at what your Maven POM file, Gradle file, or whatever to figure out why the build puts the unwanted stuff in there.
If you are not using Maven, Gradle or some other build system, check the artifact configuration that you have created to specify what goes in the JAR, and what is in the directories you have told it to include.

Eclipse Java Build Path Jar Library classes not found even if available in jar

Recently I wanted to add the nebula shelf to my eclipse plugin. Therefore I added the org.eclipse.nebula.widgets.pshelf.source_1.1.0.201701302244.jar the build path of my eclipse project.
Sadly eclipse can't find the class files inside of the jar, even after cleaning and rebuilding the whole project.
Picture:
Checking the same jar file with jd-gui results in:
Picture:
I exported the *.java files with jd-gui and copied them to my project. Using this method my project built successfully and worked as expected.
Can someone tell me how I can use the jar file without exporting all of the java files manually? Thanks for your help! :-)
Do not use source jars. You can tell eclipse while debugging to use the source jar.
Add the jar to build path: right click on jar -> build path -> add to build path
Don't try to add Eclipse plugins directly to the build path of another plugin as it won't work.
Instead add the plugin to your target platform or import it in to your workspace.
Then add the plugin to your plugin's Dependencies. In the MANIFEST.MF editor you do this on the 'Dependencies' tab in the 'Required Plug-ins' list.

Can't find .jar file for jumblr (Tumblr android wrapper)

I've been trying to add the jar file to my build path. However, I can't seem to find the jar file on their github page.
can someone please link me something that will get me to their .jar file because I really would like to use jumblr as their wrapper is very nice.
Thanks
From the GitHub README
Builds
We supply some JAR builds you can use if you're not a fan of mvn. You can grab them with (or without) dependencies from the project page.
From the project page by clicking on "JAR" you can download the project jar and if you click on "with dependencies" you can download the project with the dependencies.

How to access resource files in IntelliJ plugin's jar

I am building an IntelliJ idea plugin. I have a component TemplateComponent.java which extends the ApplicationComponent. Here is the link to the code.
I want to read some template files in the TemplateLoader. All the files are placed under root_of_project/templates. When I build the jar and install it in my IDE, I am not able to get access to the files because the plugin is packed as a jar file. However, things work as intended when I am debugging the plugin from within the IDE. Can anyone help me?
Please see com.intellij.util.PathUtil#getJarPathForClass and its usages in IDEA codebase. Unfortunately you might have to add a check if it's a directory (debug) or a jar (production), like in com.intellij.compiler.server.BuildManager#getJpsPluginSystemClassesPath

Creating Android .jar files

I want to create an Android project that contains some code, and then export that code as a .jar file to use it on another Android project.
I've already tried to create an Android project and set it as a library in the properties, and then export the project as a jar file. Aparently everything works fine, when I use my .jar file as a user library in another Android project my code inside the .jar is visible and everything compiles fine. But when I run my application it closes and say that it could not find the classes inside the .jar file.Any sugestions will be very appreciated!Thanks in advance.
Look at Project->Properties->Java Build Path->Order and Export. Make sure your jars are exported as well as imported.
Make sure your JAR is in the libs/ directory of the project using the JAR, and that it is in your build path in Eclipse.

Categories