• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Rob Spoor
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:

Is there a way to compile all JDK source?

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The reason why I try to compile JDK source is:

My program uses JDK source as test suite, does some modification on those Java source codes and generates very similar source files with same file names and hierarchy, let's call them NEW source. Now my target is to make sure these NEW source are compilable.

So, how to compile these JDK source?

Thanks.
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can compile the source just like you compile your own program "javac *.java". Or do you mean that you want to compile them programmatically in your test suite? If that's the case, the easiest, but probably least flexible, solution is to use Runtime.exec(). See the Java API documentation for the version of Java you are using for details.

Alternatively, you may want to look at the the classes available in tools.jar. I'm not sure how much documentation is publicly available, but it contains supporting classes for many of the tools you use in Java development, such as javac, java, and javadoc. I really don't know enough about what is available to provide much help, so I hope someone else can.

I hope I've helped point you in the right direction here. If not, please let us know where you can help. Try giving us some more specific information about the problems you are encountering.

HTH

Layne
 
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Note that she's not talking about src.zip; she's talking about the source for the JDK, which includes some funky stuff. In particular, there are files named *.java which nevertheless don't contain valid Java source; rhere are preprocessing instructions in them. To build the JDK from source, you pretty much have to use their makefile system, which runs the various tools that do that preprocessing and all sorts of other funky stuff.

Nancy, could you possibly use the contents of the src.zip that comes with the J2SDK download instead of using the raw JDK source? This file contains only valid Java source; instead of those funky files in java/nio, it contains the results of running the preprocessor, all perfectly valid Java source.
 
Nancy Zhang
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I noticed that there's a "windows build instructions" file under root dir of JDK source, it seems tons of work and tools needed. So I decided to use pure source code from src.zip instead.
Thanks for you all.
 
Evil is afoot. But this tiny ad is just an ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic