Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Strange problem with .jar and .class files

Reply
Thread Tools

Strange problem with .jar and .class files

 
 
Eric Tonissen
Guest
Posts: n/a
 
      01-12-2012
I have a Java program normal running. I needed some .class files from
another project, builded an .jar file from it, added this to the
classpath and it works.

But now we decided not to use the .class files anymore but to make a
copy from the corresponding sources to my own project.
So I did. But now I have a lot of compile errors about sources which
it also needs ?

I unzipped all the .jars files on the class path, but they are also
not in here.

Is it possible that the compiler includes information into the .class
files, so it doesn't need the other .class files anymore?
 
Reply With Quote
 
 
 
 
Jeff Higgins
Guest
Posts: n/a
 
      01-12-2012
On 01/12/2012 06:40 AM, Eric Tonissen wrote:
> I have a Java program normal running. I needed some .class files from
> another project, builded an .jar file from it, added this to the
> classpath and it works.
>
> But now we decided not to use the .class files anymore but to make a
> copy from the corresponding sources to my own project.
> So I did. But now I have a lot of compile errors about sources which
> it also needs ?
>


The third party project you are attempting to build has dependencies
which the compiler cannot resolve is the way I read this so far.

> I unzipped all the .jars files on the class path, but they are also
> not in here.


You are not able as yet to find the required dependencies.

>
> Is it possible that the compiler includes information into the .class
> files, so it doesn't need the other .class files anymore?


No, if I understand the question to be "has the third party packager's
build or packaging process hidden the required dependencies in some
other class file".

You must find the required dependencies and add them to your build and
packaging process.


 
Reply With Quote
 
 
 
 
Lew
Guest
Posts: n/a
 
      01-12-2012
Jeff Higgins wrote:
> Eric Tonissen wrote:
>> I have a Java program normal running. I needed some .class files from
>> another project, builded an .jar file from it, added this to the
>> classpath and it works.
>>
>> But now we decided not to use the .class files anymore but to make a
>> copy from the corresponding sources to my own project.


Why? Why?

>> So I did. But now I have a lot of compile errors about sources which
>> it also needs ?


And there's the "why not".

> The third party project you are attempting to build has dependencies which the
> compiler cannot resolve is the way I read this so far.
>
>> I unzipped all the .jars files on the class path, but they are also
>> not in here.

>
> You are not able as yet to find the required dependencies.


And you are not following a good strategy.

>> Is it possible that the compiler includes information into the .class
>> files, so it doesn't need the other .class files anymore?

>
> No, if I understand the question to be "has the third party packager's build
> or packaging process hidden the required dependencies in some other class file".
>
> You must find the required dependencies and add them to your build and
> packaging process.


But basically unpacking from a JAR and repacking into a different one is not a
good practice. It defeats the whole point of JARs, and as the OP has found,
opens a world of hurt trying to recapitulate everything that went into the JAR
build. And if the JAR is third party, you really have to watch out for
intellectual property rights. OP, why in the frak are you going down such an
unproductive path?

--
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedi.../c/cf/Friz.jpg
 
Reply With Quote
 
Jeff Higgins
Guest
Posts: n/a
 
      01-12-2012
On 01/12/2012 11:14 AM, Lew wrote:
> Jeff Higgins wrote:
>> Eric Tonissen wrote:
>>> I have a Java program normal running. I needed some .class files from
>>> another project, builded an .jar file from it, added this to the
>>> classpath and it works.
>>>
>>> But now we decided not to use the .class files anymore but to make a
>>> copy from the corresponding sources to my own project.

>
> Why? Why?
>

It's a good question, but
I sometimes have difficulty questioning motives right off the bat.
For instance another poster's intent to produce a "human readable" ascii
output of a 10,000 X 10,000 floating point matrix.

 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      01-12-2012
On Thu, 12 Jan 2012 03:40:56 -0800 (PST), Eric Tonissen
<(E-Mail Removed)> wrote, quoted or indirectly quoted someone
who said :

>Is it possible that the compiler includes information into the .class
>files, so it doesn't need the other .class files anymore?


static finals can get converted to int or String literals that no
longer reference the original class. That is why you need clean
compiles if you have inter class references of static finals that you
have changed.

The compiler has to be able to see everything referenced, either as
source on the sourcepath or class files on the classpath
--
Roedy Green Canadian Mind Products
http://mindprod.com
One of the most useful comments you can put in a program is
"If you change this, remember to change ?XXX? too".

 
Reply With Quote
 
Lew
Guest
Posts: n/a
 
      01-12-2012
On Thursday, January 12, 2012 9:34:21 AM UTC-8, Jeff Higgins wrote:
> On 01/12/2012 11:14 AM, Lew wrote:
> > Jeff Higgins wrote:
> >> Eric Tonissen wrote:
> >>> I have a Java program normal running. I needed some .class files from
> >>> another project, builded an .jar file from it, added this to the
> >>> classpath and it works.
> >>>
> >>> But now we decided not to use the .class files anymore but to make a
> >>> copy from the corresponding sources to my own project.

> >
> > Why? Why?
> >

> It's a good question, but
> I sometimes have difficulty questioning motives right off the bat.
> For instance another poster's intent to produce a "human readable" ascii
> output of a 10,000 X 10,000 floating point matrix.


The answer to "why?" informs the answer to "what?"

As Patricia and others often advise posters, tell us the goal, not just your current, possibly flawed idea of implementation. If we know why the OP wants to do such a thing, on the face of it difficult and unrewarding, we might be able to suggest an easy and satisfying way of achieving the goal.

--
Lew
 
Reply With Quote
 
Jeff Higgins
Guest
Posts: n/a
 
      01-13-2012
On 01/12/2012 04:42 PM, Lew wrote:
> On Thursday, January 12, 2012 9:34:21 AM UTC-8, Jeff Higgins wrote:
>> On 01/12/2012 11:14 AM, Lew wrote:
>>> Jeff Higgins wrote:
>>>> Eric Tonissen wrote:
>>>>> I have a Java program normal running. I needed some .class files from
>>>>> another project, builded an .jar file from it, added this to the
>>>>> classpath and it works.
>>>>>
>>>>> But now we decided not to use the .class files anymore but to make a
>>>>> copy from the corresponding sources to my own project.
>>>
>>> Why? Why?
>>>

>> It's a good question, but
>> I sometimes have difficulty questioning motives right off the bat.
>> For instance another poster's intent to produce a "human readable" ascii
>> output of a 10,000 X 10,000 floating point matrix.

>
> The answer to "why?" informs the answer to "what?"
>
> As Patricia and others often advise posters, tell us the goal, not just your current, possibly flawed idea of implementation. If we know why the OP wants to do such a thing, on the face of it difficult and unrewarding, we might be able to suggest an easy and satisfying way of achieving the goal.
>

Good advice.
Perhaps I was reading my own motivations into the OP.
I've had occasion to be dissatisfied with the packaging of "third party"
and even my own code.

I think I may not have precisely understood the process described by the
OP.
Referencing the two paragraphs above.

Beginning with "I have a Java program ...",
I can read this several ways:
a) I snagged some binary class files from another project and packaged
them in a jar,or
b) I built and jar packaged another project using it's own build process,or
c) I built (perhaps a subset) of the classes from another project and
packaged them in a jar.

Beginning with "But now we decided ..."
I suspect here is where the process breaks:
It sounds like:
I am attempting to build (perhaps a subset of) another project using my
own build process.

If I look at for instance Javolution library, their build process
includes a non-standard text substitution step to include or not Java
generics.
 
Reply With Quote
 
Lew
Guest
Posts: n/a
 
      01-13-2012
Jeff Higgins wrote:
> If I look at for instance Javolution library, their build process includes a
> non-standard text substitution step to include or not Java generics.


??!

--
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedi.../c/cf/Friz.jpg
 
Reply With Quote
 
Jeff Higgins
Guest
Posts: n/a
 
      01-13-2012
On 01/13/2012 12:05 AM, Lew wrote:
> Jeff Higgins wrote:
>> If I look at for instance Javolution library, their build process
>> includes a
>> non-standard text substitution step to include or not Java generics.

>
> ??!
>

A method signature in the .templates.javolution.text package:
public final Appendable/*TextBuilder*/ append(char c)
becomes
public final Appendable<TextBuilder> append(char c)
in the javolution.text package before compilation.


 
Reply With Quote
 
Jeff Higgins
Guest
Posts: n/a
 
      01-13-2012
On 01/13/2012 03:41 AM, Jeff Higgins wrote:
> On 01/13/2012 12:05 AM, Lew wrote:
>> Jeff Higgins wrote:
>>> If I look at for instance Javolution library, their build process
>>> includes a
>>> non-standard text substitution step to include or not Java generics.

>>
>> ??!
>>

> A method signature in the .templates.javolution.text package:
> public final Appendable/*TextBuilder*/ append(char c)
> becomes
> public final Appendable<TextBuilder> append(char c)
> in the javolution.text package before compilation.
>

or not, depending upon the build parameters.

Which is apropos the OP, if that is your question,
if his process worked when he snagged some binaries
and didn't work when he attempted to build from source.

Which is one imagined scenario from a world of others.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to check what symbols are defined in a .o files? .a files? and.so files in linux? yinglcs@gmail.com C++ 3 01-18-2009 05:23 PM
AVG Email Scanner activating at strange times with strange IP addresses dennispublic@hotmail.com Computer Support 1 08-26-2006 04:27 AM
Text files read multiple files into single file, and then recreate the multiple files googlinggoogler@hotmail.com Python 4 02-13-2005 05:44 PM
Help! Files, Files, and more Files ... Everywhere JeffS Digital Photography 22 09-19-2004 01:47 AM
Question About Strange 'C' Code Syntax ( Well strange to me anyway ) Harvey Twyman C Programming 8 10-25-2003 05:54 AM



Advertisments