• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Jj Roberts
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Himai Minh
  • Carey Brown
  • salvin francis

Is there a way to compile all JDK source?

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • 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
  • 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: 24203
43
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
I don't always make ads but when I do they're tiny
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic