Class Question [message #169320] |
Mon, 19 July 2004 14:39  |
Eclipse User |
|
|
|
Does anyone know if there is a way to dump Eclipse's compiler options that
it will use when your Java source files are compiled by the interface? I am
trying to use the javac ANT task to compile the same Java source and I can't
get the two class files to be identical.
I have tried using a -g:none option on the ANT task and turning off all the
debug settings in Eclipse but the class files are still different.
I guess what I am asking for is to be able to see the compiler options
Eclipse is using when it compiles java source.
Any help will be greatly appreciated.
Marty Jones
|
|
|
|
|
Re: Class Question [message #169369 is a reply to message #169346] |
Mon, 19 July 2004 15:12   |
Eclipse User |
|
|
|
Originally posted by: manahan.NOSPAM.ca.ibm.com
A JRE isn't a compiler and doesn't have a compiler, it is a runtime.
When you set your JRE to compile "against" , eclipse compiles using the
set of jars in the JRE when it compiles your java code.
As Eric says eclipse has its own compiler and no two compilers normally
will generate byte for byte the same class file.
Peter
Marty Jones wrote:
> Eric,
>
> I thought that Eclipse would use the JRE that you specify in the preferences
> section to build and run your Java applications?
> If it doesn't then what is the point of Setting up your JRE within Eclipse?
>
> "Eric Rizzo" <eclipse@rizzoweb.com> wrote in message
> news:cdh4s2$sgr$1@eclipse.org...
>
>>Marty Jones wrote:
>>
>>
>>>Does anyone know if there is a way to dump Eclipse's compiler options
>
> that
>
>>>it will use when your Java source files are compiled by the interface?
>
> I am
>
>>>trying to use the javac ANT task to compile the same Java source and I
>
> can't
>
>>>get the two class files to be identical.
>>
>>Are you specifying the Eclipse compiler for your Ant script? If not, it
>>will default to using Sun's JDK javac compiler. If that is the case,
>>read on...
>>As you may know, Eclipse uses it's own compiler, not Sun's javac. You
>>are not going to get javac-compiled classes and Eclipse-compiled classes
>>to be identical. Different compilers produce (slightly) different .class
>>files - that is just the nature of compilers.
>>I don't know why you're trying to get them to be identical, but one
>>option that might help you is to tell Ant to use the Eclipse compiler
>>instead of Sun's javac. I don't know off the top of my head the exact
>>property and value, but I'm sure you can find it by searching these
>>newsgroups or Googling.
>>
>>HTH,
>>Eric
>
>
>
|
|
|
|
Re: Class Question [message #169384 is a reply to message #169369] |
Mon, 19 July 2004 15:16   |
Eclipse User |
|
|
|
Peter,
Sorry for the Brain Fart. I understand what you are saying.
Thanks for the Info.
Marty Jones
"Peter Manahan" <manahan@NOSPAM.ca.ibm.com> wrote in message
news:cdh6c0$uc7$2@eclipse.org...
> A JRE isn't a compiler and doesn't have a compiler, it is a runtime.
> When you set your JRE to compile "against" , eclipse compiles using the
> set of jars in the JRE when it compiles your java code.
>
> As Eric says eclipse has its own compiler and no two compilers normally
> will generate byte for byte the same class file.
>
> Peter
>
> Marty Jones wrote:
>
> > Eric,
> >
> > I thought that Eclipse would use the JRE that you specify in the
preferences
> > section to build and run your Java applications?
> > If it doesn't then what is the point of Setting up your JRE within
Eclipse?
> >
> > "Eric Rizzo" <eclipse@rizzoweb.com> wrote in message
> > news:cdh4s2$sgr$1@eclipse.org...
> >
> >>Marty Jones wrote:
> >>
> >>
> >>>Does anyone know if there is a way to dump Eclipse's compiler options
> >
> > that
> >
> >>>it will use when your Java source files are compiled by the interface?
> >
> > I am
> >
> >>>trying to use the javac ANT task to compile the same Java source and I
> >
> > can't
> >
> >>>get the two class files to be identical.
> >>
> >>Are you specifying the Eclipse compiler for your Ant script? If not, it
> >>will default to using Sun's JDK javac compiler. If that is the case,
> >>read on...
> >>As you may know, Eclipse uses it's own compiler, not Sun's javac. You
> >>are not going to get javac-compiled classes and Eclipse-compiled classes
> >>to be identical. Different compilers produce (slightly) different .class
> >>files - that is just the nature of compilers.
> >>I don't know why you're trying to get them to be identical, but one
> >>option that might help you is to tell Ant to use the Eclipse compiler
> >>instead of Sun's javac. I don't know off the top of my head the exact
> >>property and value, but I'm sure you can find it by searching these
> >>newsgroups or Googling.
> >>
> >>HTH,
> >>Eric
> >
> >
> >
>
|
|
|
|
|
Re: Class Question [message #169777 is a reply to message #169665] |
Thu, 22 July 2004 06:40  |
Eclipse User |
|
|
|
Please also note that you may use the Eclipse Java compiler independantly
from Eclipse
as a command line tool (instead of javac), see instructions at:
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/jdt- core-home/howto/batch%20compile/batchCompile.html
"Marty Jones" <marty_jones@dailyaccess.com> wrote in message
news:cdlvts$q1j$1@eclipse.org...
> Eric,
>
> The reason I wanted to use the Sun compiler was to verify the class files
> for an automated build system that we are working on. I am automatically
> building Java class files using the javac ant task. I wanted to compare
> those class files against our current production set of code that is
> compiled using Eclipse. When I compared the files I would get class
> differences. For our testing purposes I just compiled our production code
> base using the javac Ant task instead of Eclipse and then compared the two
> sets of class files.
>
> Thanks for all your help,
>
> Marty
>
>
> "Eric Rizzo" <eclipse@rizzoweb.com> wrote in message
> news:cdjbmo$ifu$1@eclipse.org...
> > Marty Jones wrote:
> >
> > > Eric,
> > >
> > > Is there a way in Eclipse for you to overwrite the use of Eclipse's
Java
> > > Compiler and use a Sun Java Compiler?
> >
> > Not directly. The only option in that area would be to disable the
> > Eclipse builder (Java compiler) for that project and instead write an
> > Ant script that uses javac. You could then set it up to run that Ant
> > script for every build (file save) or to invoke it manually when you
> > wanted to build. I recommend against that, however - it is really kind
> > of wrestling with Eclipse.
> >
> > Can you share why it is you must use the Sun compiler? Eclipse's
> > compiler does adhere to the Java spec and produces perfectly fine byte
> code.
> >
> > HTH,
> > Eric
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.05853 seconds