Generate .JAR from IntelliJ - java

I am attempting to create a JAR from IntelliJ using the build artifacts but when I do it is saying
Error: Invalid or corrupt jarfile
Im not sure what im doing wrong though?

Hard to tell from what you have posted. Intellij can be finicky at times especially with the Artifact jar build interface. There is a good tutorial on IntelliJ's website on how to set up the artifact. One area that may provide difficulty is pointing to the Main Class.
An issue I had in building a jar using the tool was selecting the Main Class. Ultimately I typed it in and it worked. Not sure if this is the advice that will solve your problem.
From the intellij website at: https://www.jetbrains.com/help/idea/creating-and-running-your-first-java-application.html
Note the image below.
Other potential issues could be that a dependency was corrupted, although doubtful.
Could also be the Manifest file is referencing a file that is causing the issue. Most Manifest files should be fairly simple and point to the main class. Last but not least email IntelliJ. They are good at responding and if the problem is one that intellij can solve, they will help. Unfortunately they only respond by email and sometimes can take up to a day.

Related

Error when validating Xtext DSL in standalone Java project

I recently followed Sebastian Zarnekow's short guide on how to deploy an Xtext DSL into a standalone project (found here: http://zarnekow.blogspot.co.uk/2010/06/how-to-deploy-xtext-standalone.html)
However I receive the following error when attempting to run the project...
"The string resource '_UI_DiagnosticRoot_diagnostic' could not be located"
Could this be something to do with how the JAR is exported, I chose the "Extract required libraries into generated JAR" option, if I try to use the second option where the libraries are packaged into the JAR I receive a different error telling me that a main method could not be found.
Has anyone come across this issue before? I tried updating EMF and Xtext but it didn't seem to have any affect.
Any help is appreciated.
this should be a "warning" only - maybe logged as error but not prevent the program from running.
the problem is there a multiple plugin.properties in the root of the jars that may override each other. seems one from the org.eclipse.emf.ecore is going lost.
so you may create a plugin.properties that contains this (and maybe other keys) as well.

Multiple dex files error when building project downloaded from git

So I have a project that works totally fine in one workspace on my machine. I push it to the repository so everyone else can work on it. I go to pull it down making sure all the changes are good. I import the project into a new workspace and using eclipse with autobuild on it produces no errors.
I go to the command line and run ant clean release on the project and right before it gets to run crunch on the assets the build fails with a mulitple dex files define error. Ive checked the project high and low and compared to the other copy of it in the original workspace but for what ever reason I cant get it to build. I erase the bin and gen folders and remove all the imports and basically leave just the project, run clean in eclipse, and still get a dex define error related to one of the lib projects classes. Ive tried to find where extra copies could be but I dont find anything.
googling around for the past few days hasnt helped as the normal solutions to such a problem havent worked for me. So what is the best way to figure out where the extra class definitions are coming from so I can get rid of them and fix the repository so I can use it correctly. I have a feeling its related to one of the files in the project that I should be excluding in my gitignore but Im not sure which that would be. Any help on the matter would be greatly appreciated cause this has eaten quite a bit of time of just messing around.
When you have more than one class with the same package name this error would raise.
One of the common source of this issue is when you have for example different version on the same library.
For example your add ActionbarSherlock which in 'libs forder has it's own support library and also your project has another version of support library in it's libs folder. In such a cases you should put one version of support library.jar to all different libraries that you using it.
I hope this could help you.
I didnt find the root of the problem but I figured out a fix. I moved all the support libraries to a new root folder completely away from the android project. Once I did that and cleaned everything I then ran ant clean release and the project built fine.

Fixing "ExtLibUtil cannot be resolved" issue

I have been working on trying to use the openLogger tool which uses the OpenLog Database also available at openNTF, and I have hit a bit of a snag. My question is not about those databases explicitly, they are just a good example of what is going wrong!
My issue is that I wanted to rebuild the OpenLogger Demo/test database after making a few changes to the xsp.properties file, and I suddenly was presented the wonderful gift of 12 or more errors, all of which were that the com.ibm.xsp.extlib.util.ExtLibUtil class could not be resolved.
After a bit of googling, I found out that it sometimes helps to re-install Designer - done (three times)or to re-install the ExtLibs (done a few times and then upgraded to the 900_201305* version)
nothing.
I have really tried everything I can think of, and everything that I could find via google, but I cannot figure out how to get this thing to resolve. I remember once upon a time having to copy specific jar files into the designer install directory, but I cannot remember the details, nor can I find anything about that, nor do I know if this is my issue. I also thought about a specific designer variable not being set that would tell designer where to find the jar files, but I would not know where to begin searching for that.
Any help getting this thing to resolve would be a HUGE! help. It could also be that I wish to use this awesome looking class in my own applications. Thanks!
To make sure that the jar files is found and able to be used, try these things:
Use the package explorer to make sure the jar is in the "Referenced Libraries" folder
Check the build path, and add the jar to the build path if necessary
Examine the XSP properties file and make sure it looks correct, and then change something and resave it
Use Project | Clean which sometimes fixes issues like this

Problems getting Jar file to link correctly. Verify Errors

I've been searching the web for a long time, and it seams that this VerifyError isn't that uncommon and can have multiple reasons for tripping. I have created a project, that I've exported as a jar file. It is built with android 2.2 (API 8). This part works fine. But I have a separate project that when I try to import it, I start having problems.
The only way I've been able to get it to work, is to import the jar into a libs folder I created. It then get's automatically added as an Android Dependency and I can use it fine, however I can't attach my javadoc file to it, and in my build configuration it says I can't modify the dependency. (Can't link to a javadoc).
What I thought I should be able to do is simply add it as an external jar, then link the javadoc and source. If I do this, the code that uses the jar shows no errors, and the javadoc comments work. However I keep getting a VerifyError when I run it. I've attached a stack trace that shows the errors. I'm completely out of ideas, does anyone have any suggestions? Am I building the jar file wrong? Am I importing it wrong?
If anyone can help point me in a constructive direction, it would be really appreciated.
Thanks
Stack trace:
Ok, so this was frustrating to solve. The solution took about 20 seconds when I spent over an hour researching the problem.
What I had to do was go to:
Properties -> Java Build Path -> Order and Export
But rather than just clicking the external jar, I had to move it up to the top of the list for the build path order.
Credit definitely goes to yorkw for pointing me in the right direction.
I believe that Android jar files are a little different.
You could try putting the JAR files into the Android "dx" tool
It's in the ~/android-sdk/platform-tools

import wavemaker statement cannot be resolved

I am taking over code someone else wrote and am having to find everything they used for this project manually because they didn't send everything that was needed. (One of those out of the country contract work deals.) Anyway, I'm having trouble finding something. They imported com.wavemaker.runtime.data, com.wavemaker.runtime.services and com.wavemaker.json.type and I can't figure out how to get these unresolved errors to go away. I've moved WaveMaker into the same folder as my project and I've searched high and low for a .jar file on my machine and on the internet to no avail. Please help?? (FYI I'm using Eclipse & Java)
This is easy, you have to add the jars to the eclipse configuration path (i.e: ~/WaveMaker/projects/wm_example_project/lib), when you find it, make sure that you add all those libs to your build path.

Categories

Resources