Hello
I have application code that runs fine when executed from inside
Eclipse IDE.
However when I make a jar "myApp.jar" out of it then the jar does not
run. If I however remove a certain object of a certain class C from my
code and generates a new "myApp.jar", then the new jar runs fine
aswell.
The class C which I remove from the code to make it work is located in
an external jar "x.jar".
Inside the IDE, I have included x.jar in the buildpath of the project.
My thought is that the class C is not found in runtime when executing
"myApp.jar".
Where should I put the x.jar for the JRE to find when executing
myApp.jar?
|
|
0
|
|
|
|
Reply
|
marcussilfver (26)
|
3/26/2008 10:44:35 AM |
|
marcussilfver@gmail.com wrote in news:d6ad2e8f-d687-4048-8f22-44746f7cd069
@t54g2000hsg.googlegroups.com:
> Hello
> I have application code that runs fine when executed from inside
> Eclipse IDE.
> However when I make a jar "myApp.jar" out of it then the jar does not
> run. If I however remove a certain object of a certain class C from my
> code and generates a new "myApp.jar", then the new jar runs fine
> aswell.
>
> The class C which I remove from the code to make it work is located in
> an external jar "x.jar".
> Inside the IDE, I have included x.jar in the buildpath of the project.
>
> My thought is that the class C is not found in runtime when executing
> "myApp.jar".
>
> Where should I put the x.jar for the JRE to find when executing
> myApp.jar?
To the classpath
java -cp .;/path/to/the/x.jar;/possible/other/jars -jar myApp.jar
|
|
0
|
|
|
|
Reply
|
spam1957 (140)
|
3/26/2008 11:33:03 AM
|
|
On Wed, 26 Mar 2008 03:44:35 -0700, marcussilfver wrote:
> Hello
> I have application code that runs fine when executed from inside Eclipse
> IDE.
> However when I make a jar "myApp.jar" out of it then the jar does not
> run. If I however remove a certain object of a certain class C from my
> code and generates a new "myApp.jar", then the new jar runs fine aswell.
>
> The class C which I remove from the code to make it work is located in
> an external jar "x.jar".
> Inside the IDE, I have included x.jar in the buildpath of the project.
>
> My thought is that the class C is not found in runtime when executing
> "myApp.jar".
>
> Where should I put the x.jar for the JRE to find when executing
> myApp.jar?
Do a search for jar mainifest. That should tell you how to include x.jar
in the classpath and make your jar file double clickable.
I'm surprised Eclipse doesn't do this for you, or maybe it does but you
aren't packaging it correctly after.
For example, taking a similar approach as you have in Netbeans will
create myApp.jar (horrible name) and put it in dist/. It will also put
dependencies in the relative directory lib/, that is, dist/lib/. You can
then copy the contents of dist/ anywhere and it will run.
Check out what is in bin/ in Eclipse.
Lionel.
|
|
0
|
|
|
|
Reply
|
lionelv_ (143)
|
3/26/2008 12:30:24 PM
|
|
marcussilfver@gmail.com wrote:
>> I have application code that runs fine when executed from inside
>> Eclipse IDE.
>> However when I make a jar "myApp.jar" out of it then the jar does not
>> run. If I however remove a certain object of a certain class C from my
>> code and generates a new "myApp.jar", then the new jar runs fine
>> aswell.
>>
>> The class C which I remove from the code to make it work is located in
>> an external jar "x.jar".
>> Inside the IDE, I have included x.jar in the buildpath of the project.
>>
>> My thought is that the class C is not found in runtime when executing
>> "myApp.jar".
>>
>> Where should I put the x.jar for the JRE to find when executing
>> myApp.jar?
Donkey Hot wrote:
> To the classpath
>
> java -cp .;/path/to/the/x.jar;/possible/other/jars -jar myApp.jar
There's no point in putting a -cp option there if you use -jar. The classpath
will be completely ignored due to the -jar option.
<http://java.sun.com/javase/6/docs/technotes/tools/solaris/java.html>
> When you use this option [-jar], the JAR file is the source of all user classes,
> and other user class path settings are ignored.
The answer is the Class-Path manifest attribute
<http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Manifest%20Specification>
Place the library JAR in the same directory as the application JAR, or a
subdirectory, and reference it from the manifest of the application JAR.
--
Lew
|
|
0
|
|
|
|
Reply
|
lew (2143)
|
3/26/2008 12:54:06 PM
|
|
On 26 Mar, 13:54, Lew <l...@lewscanon.com> wrote:
> marcussilf...@gmail.com wrote:
> >> I have application code that runs fine when executed from inside
> >> Eclipse IDE.
> >> However when I make a jar "myApp.jar" out of it then the jar does not
> >> run. If I however remove a certain object of a certain class C from my
> >> code and generates a new "myApp.jar", then the new jar runs fine
> >> aswell.
>
> >> The class C which I remove from the code to make it work is located in
> >> an external jar "x.jar".
> >> Inside the IDE, I have included x.jar in the buildpath of the project.
>
> >> My thought is that the class C is not found in runtime when executing
> >> "myApp.jar".
>
> >> Where should I put the x.jar for the JRE to find when executing
> >> myApp.jar?
> Donkey Hot wrote:
> > To the classpath
>
> > java -cp .;/path/to/the/x.jar;/possible/other/jars -jar myApp.jar
>
> There's no point in putting a -cp option there if you use -jar. =A0The cla=
sspath
> will be completely ignored due to the -jar option.
>
> <http://java.sun.com/javase/6/docs/technotes/tools/solaris/java.html>
>
> > When you use this option [-jar], the JAR file is the source of all user =
classes,
> > and other user class path settings are ignored.
>
> The answer is the Class-Path manifest attribute
> <http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Manifest%20Spe...>=
>
> Place the library JAR in the same directory as the application JAR, or a
> subdirectory, and reference it from the manifest of the application JAR.
>
> --
> Lew- D=F6lj citerad text -
>
> - Visa citerad text -
thanks everyone answering. I got it working now!
regards
Marcus
|
|
0
|
|
|
|
Reply
|
marcussilfver (26)
|
3/26/2008 2:44:18 PM
|
|
On Wed, 26 Mar 2008 03:44:35 -0700 (PDT), marcussilfver@gmail.com
wrote, quoted or indirectly quoted someone who said :
>Where should I put the x.jar for the JRE to find when executing
>myApp.jar?
Normally you build jars with ant scripts. See
http://mindprod.com/jgloss/ant.html
You might have a look at some of my jars
http://mindprod.com/products.html to see the structure. Look inside
your jars to make sure all the class files are there and they are
named correctly, and resources are present, and the manifest is
correctly built.
See http://mindprod.com/jgloss/jar.html
http://mindprod.com/jgloss/jarexe.html
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
|
|
0
|
|
|
|
Reply
|
see_website (4858)
|
3/26/2008 5:00:13 PM
|
|
|
5 Replies
25 Views
(page loaded in 0.119 seconds)
Similiar Articles: OT -- Windows 7 & 16-bit apps - comp.lang.xharbour... analog in Win7) to execute my older 16-bit stuff apps in Win 7 ? Thanks for any guidance. ... 64-bit Win 7 DOES NOT run 16-bit applications. You ... Connecting a GUI to a Derby Database with NetBeans IDE - comp.lang ...... JdbcRowSet (execute) : Schema 'NBUSER' does not exsit ... In my application code I ... with NetBeans IDE By forsini on Feb 14, 2007 ... there is also a "Working with ... J2ME & Eclipse - comp.lang.java.programmer... the application and run it both in the emulator outside of eclipse using emulatorw, and also on my Nokia phone.I just can not run ... does the "grunt work" of ... IDE), the ... file opening slows down - puzzling - comp.lang.xharbour... interface from outside ... running Linux and executing the program under Wine. Why not? ... I was not aware of it. Many thanks. All my applications, as I said, work that way ... RDTSC (was: Fastest logical not) - comp.lang.asm.x86If I tried, Windoze terminated my application immediately. ... With my (not MP aware) OS/2, running on a dual ... x86 - page 20 RDTSC (was: Fastest logical not) 12 113 A working ... Copy protected programs on SunPCi card. - comp.sys.sun.admin ...That did not work. The CD functions fine with other ... The Sun does not have an IDE CD-drive, but uses the Sun's SCSI one. ... when a user decided to use something outside the ... interface matlab with Code composer studio - comp.soft-sys.matlab ...Executing Matlab code using Visual basic - comp.soft ... comp.soft-sys.matlab The interface block is not working ... Automation Interface provides an application program ... Abaqus + gfortran + fortran 90 = illegal memory reference - comp ...That's a useful reminder [snip] > does not work is ... no point in even trying to solve the problem outside ... IDE for ifort on Linux - comp.lang.fortran Abaqus ... AccessControlException with JMS, WebStart, and WebLogic - comp ...I am apparently missing something, but I'm not sure what. My ... Here is the code I am executing Hashtable env ... an issue with WebLogic, and BEA's recommended work ... code speed moving from fortran 77 compiler to f2003 compiler ...... automatic parallelization: My feeling is that it often does not work and ... switch which has more widespread application than does ... free compiler - comp.lang.fortran IDE ... Cannot execute program outside VFP9 IDE.Cannot execute program outside VFP9 IDE. ... everytime i want run my application or work on my application is simply not a ... Packaging and Deploying Desktop Java Applications... have is: "Now that I've created my application in the IDE, how do I get it to work from the command line outside ... but double-clicking still does not execute ... 7/6/2012 11:28:37 PM
|