Building .jar

已回答

I have gotten to the point in my project that i want to test it on another device.

 

Problem is it relies on 2 libraries. How can i take the project im working on and build a jar so i can ensure it works on another system with a different operating system. (windows 7/raspi pi)

 

I checked for build artifact, but it faded out. Am i doing something wrong?

 

EDIT: i was able to get it to jar it. But when i run it, nothing happens.

评论操作 固定链接

i tried following the instructions, but the options are slightly different and when i try running the jar nothing still happens.

 

https://www.youtube.com/watch?v=mNWjJoXN-Ik&feature=youtu.be

 

Heres a youtube video unlisted of me showing you what i tried doing., Its a minute long.

0
评论操作 固定链接

If any of the jars in the deps was signed, the final jar will not work, see https://stackoverflow.com/a/45169655/104891.

0
评论操作 固定链接

I read the response, but its completely lost on me.

 

I only use Bitcoinj and Zxing for bitcoin/QRCode reading. I have no clue if they are signed or not. Where would i confirm this?

0
评论操作 固定链接

Look inside the jars for the files mentioned in the link.

0
评论操作 固定链接


I dont have those same dependencies. 

0
评论操作 固定链接

Unpack the jars in this list in your file manager to check inside the jars.

0
评论操作 固定链接

this is what im looking for??

 

mssql-jdbc-6.2.0.jre8.jar <--??

0
评论操作 固定链接

You are looking for MSFTSIG.RSA and MSFTSIG.SF files inside any of the jars listed in the dependencies.

What is the error displayed in the console when you run the jar? Can you share the final jar that doesn't run?

0
评论操作 固定链接

no errors display. it just seems the program doesnt run. It loads something but then nothing.

 

https://mega.nz/#!QVwAyR4C!1ukzvTFZcnWZ-6phZfwpavc86_2e0arHrGCsFrKI3Vo

 

The above is the jar. I am currently going through the list to see if i can find it.

0
评论操作 固定链接

This jar doesn't specify the main class in the manifest, the error displayed is:

no main manifest attribute, in wallettemplate.jar

The manifest file inside the jar looks like this:

Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Built-By: ken
Created-By: Apache Maven
Build-Jdk: 1.6.0_29

It could be that one of the dependent jars already has the manifest file that overrides your custom manifest that specifies the main class.

See the comment from Nikolay at https://youtrack.jetbrains.com/issue/IDEA-116209 for the workaround.

0
评论操作 固定链接

would the main class be the file i load the run the program?

0
评论操作 固定链接

Yes, it's the class that starts your app and has public static void main method.

0
评论操作 固定链接

i got that, its MainPage.java.

 

Wouldnt that follow under the wallettemplate module??

0
评论操作 固定链接

Your screenshot shows this manifest file. Make sure this file specifies the Main class and is at the top of the dependencies.

In fact you can specify any MANIFEST.MF file using the following steps:

0
评论操作 固定链接

Manifest-Version: 1.0
Main-Class: wallettemplate.MainPage

my new manifest.mf

 

How can i tell if i need to specify my class path. And to what?

0
评论操作 固定链接

You don't need to specify it.

0
评论操作 固定链接

Look inside the jar manifest file, it looks like this:

Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Built-By: srowen
Created-By: Apache Maven
Build-Jdk: 1.6.0_29

It's not your manifest. You must change the order of the dependencies to make your manifest on the top so that it overrides all the dependent manifests. I've already described this process above.

0
评论操作 固定链接

https://mega.nz/#!MIZ3WKQQ!uoeLTKqeb-OfYxO3kZmj-iuL-05UlX-kgjxGmb886vk

 

Im getting an error now, A java exception has occured.

 

I extracted the JAR file and the manifest appears to be correct., Building this and running on my IDE and it works fine.

0
评论操作 固定链接

You've changed the packaging in the jar, before the dependent jars were extracted into the main jar, now they are just packed inside the jar. So you have jars inside the jar. This way the dependencies are not in the classpath and your app will not work. You have to change the packaging back to have the extracted jars inside the main jar.

0
评论操作 固定链接

where can i see this option? Im still learning your IDE in regards to this.

0
评论操作 固定链接

 

lso read your post. but i still dont see anything that talks about this.

0
评论操作 固定链接

When creating a new artifact:

When editing existing one:

 

Sorry, I can't be more clear. If you don't understand it, you may need to try some other IDE or some other way to create the jar file for your app, like Ant, Maven or Gradle.

0
评论操作 固定链接

So i got it extracted, but the manifest is still getting the wrong one.

 

https://youtrack.jetbrains.com/issue/IDEA-116209

 

I am following this, but stuck on step 2.

 

"2) click on the + button, select Extracted Directory, select the module's lib directory, and then control click with mouse to add all of the jar files"

 

Whatever i click will not allow me to open. What is this looking for?

0
评论操作 固定链接

You need to change the order of the entries and to move Manifest file to the top as described in Nikolay's comment I've quoted above.

 

0
评论操作 固定链接

made progress.

 

First off i put the manifest on top, but the result were the same.

 

I then realized that virtually all the jars included contains their own manifest. Does this mean i have to go into these jars and remove them? These are needed.

0
评论操作 固定链接

The manifest on top should overwrite all the other manifests from the dependencies, that was the point of moving it to the top after all.

What error do you get now? Can you share the non working jar? Did you check that the manifest in your final jar is actually the one you need?

0

请先登录再写评论。