IntelliJ Building Jar - META_INF Can't resolve main class

I'm trying to get started on IntelliJ. I've setup my project, and I'm now trying to create the JAR file.

The Jar File outputted is of wrong size (Below 1KB), and should be  40KB+. After unzipping the Jar File, there are two files which are not  in my "main" folder.

Here is a picture of my project layout. SmashSpotify is the main class.

https://www.dropbox.com/s/qm0usrhtz1v40uz/Screenshot%202015-08-20%2021.01.42.png?dl=0

The META_INF, I'm not sure what it's used for, is in the resources  folder. Not in the main/java folder (where all my code is, if this  helps).

This is my Project Structure -> Artifacts screenshot:

https://www.dropbox.com/s/c17wwx8j64mlc87/Screenshot%202015-08-20%2021.02.48.png?dl=0


How can I successfully create a JAR that includes everything from my main/java directory?
Thanks, Toby.
14 comments
Comment actions Permalink

Main class is specified incorrectly, you are missing the package.

According to your settings the jar should include all the compiler output. If you need the libraries/dependencies, you have to add them in the artifact configuration, see http://www.jetbrains.com/idea/webhelp/configuring-artifacts.html .

0
Comment actions Permalink

Thanks for your reply.

By looking at my project structure, could you tell me what the Main-C
lass should be? (SmashSpotify) is my main class.

Thanks again,
Toby.

0
Comment actions Permalink

Whatever you have specified as classpath should be prefexed to the class name.

0
Comment actions Permalink

In the META_INF, I've got my class-path set as com.IntenseArmadillo.smashspotify.bukkit. Is this
correct?:

https://www.dropbox.com/s/qm0usrhtz1v40uz/Screenshot%202015-08-20%2021.01.42.png?dl=0

What does Main-Class need to be?
0
Comment actions Permalink
Main-Class: com.IntenseArmadillo.smashspotify.bukkit.SmashSpotify


0
Comment actions Permalink

Gives me: "Invalid Main Class"

SmashSpotify.jar IS the Jar name I'm creating btw. If this matters.

Sorry, I really have no clue what I'm doing.

Thanks!

0
Comment actions Permalink

If your class doesn't have Main method, it's not technically the Main class, so you don't need to specify it.

It's used for executable jars. If you jar is some plug-in, it may not need to specify the Main class at all.

0
Comment actions Permalink

Yes it is a plugin, so I can just remove the Class-Path and Main-Class.

This still doesn't solve my issue of everything in com.IntenseArmadillo.smashspotify doesn't get compiled properly. The Jar File is 1KB and should be 40KB+.

Here is my artifact settings:
https://www.dropbox.com/s/c17wwx8j64mlc87/Screenshot%202015-08-20%2021.02.48.png?dl=0

0
Comment actions Permalink

You didn't include any libraries in the artifact.

If they are needed, you should do it per http://www.jetbrains.com/idea/webhelp/configuring-artifacts.html .

0
Comment actions Permalink

No additional Libraries are needed besides the code I wrote, in com.InteneArmadillo.x

If I do add additional libraries, they do show inside the JAR file when I unzip it. However, my code. com.IntenseArmadillo.x does not.

Please advise, thanks.

0
Comment actions Permalink

Attach a sample project to reproduce the problem.

0
Comment actions Permalink

Hi,

I've attached a simple version of my project below.

Thanks,
Toby.



Attachment(s):
test project.zip
0
Comment actions Permalink

This project doesn't have any artifacts configured.

0

Please sign in to leave a comment.