ali-rezvani / onejar-maven-plugin

Maven onejar plugin
0 stars 0 forks source link

Execution of one-jar does not work #14

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Execute command line java -jar xxxxxxx.one-jar.jar

What is the expected output? What do you see instead?
I expect the main class to be executed within the jar. I see an exception 
instead:

Exception in thread "main" java.lang.IllegalAccessException: Class 
com.simontuffs.onejar.Boot can not access a member of class 
RMB.CreditConsole.Program with modifiers "public static"
        at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
        at java.lang.reflect.Method.invoke(Method.java:578)
        at com.simontuffs.onejar.Boot.run(Boot.java:306)
        at com.simontuffs.onejar.Boot.main(Boot.java:159)

What version of the product are you using? On what operating system?
I am using version 1.4.1 of one-jar on Windows 2000 OS.

Please provide any additional information below.
Could the exception mean that I need to state my mainClass package 
differently? It worked when I used that as my package and class for just a 
normal jar without the dependencies.

Original issue reported on code.google.com by Elisha.N...@gmail.com on 2 Jun 2009 at 6:36

GoogleCodeExporter commented 9 years ago
Thank you Elisha for taking time to file this issue.

The error message seems to suggest that the problem can be fixed either in your 
main
class, or in Simon Tuffs' OneJAR library. It's specifically the "public static 
class"
I'm worried about, compared to "public class" which is normally used. I would 
like to
see the source for your RMB.CreditConsole.Program class, to figure it out. Can 
you
please attach it?

/Hugo

Original comment by hugo.josefson.old@gmail.com on 2 Jun 2009 at 7:33

GoogleCodeExporter commented 9 years ago
Hey Hugo, The issue was that my class was just declared as 'class' not 'public 
class'. When I changed the access modifier to 'public class' it seemed to find 
the 
main method. Which is still kind of odd since the normal jar still seems to 
find the 
method regardless. However, Not all my dependencies seem to be added, 
particularly 
all my dependencies on other prjects? I do declare them in my pom as 
dependencies 
the exact same way I do for the external jars. Any help?

Thanks so much,

Elisha

Original comment by Elisha.N...@gmail.com on 2 Jun 2009 at 8:26

GoogleCodeExporter commented 9 years ago
Apparently, according to
http://java.sun.com/docs/books/tutorial/getStarted/application/ you should be 
able to
have the class declared as 'class' and not 'public class'. The OneJAR library 
should
support that, bit seems not to.

And yes, you should declare your dependencies in your pom as usual. They should 
then
be picked up and included in the one-jar.jar. If they don't, please file a 
separate
issue and attach your pom.xml to that.

/Hugo

Original comment by hugo.josefson.old@gmail.com on 2 Jun 2009 at 9:09

GoogleCodeExporter commented 9 years ago
Closing this issue as WontFix, because I made no changes to 
onejar-maven-plugin. Any
changes needed for picking up your non-public class would be required in the 
OneJar
library itself (i.e. not in the maven plugin). http://one-jar.sourceforge.net/

/Hugo

Original comment by hugo.josefson.old@gmail.com on 12 Jun 2009 at 6:57