Include File

S

Sun

Have anyone an idea for including a file in a Java source code (not JSP)?

Thanks to all in advance!
Riccardo
 
D

DigiAl

Sun said:
Have anyone an idea for including a file in a Java source code (not JSP)?

Thanks to all in advance!
Riccardo


Why would you want to do that? For server side / messy programming it is
needed but for Java (and anyother similar languages) its not really needed.

alan.
 
H

Harald Kirsch

Sun said:
Have anyone an idea for including a file in a Java source code (not JSP)?


If you insist in making your life really miserable,
then there is nothing
to prevent you from either using cpp or m4, like
in a C program. Except you have to call cpp
yourself, because javac will not do this for you.-)

Harald.
 
R

Roedy Green

Have anyone an idea for including a file in a Java source code (not JSP)?

Write a little macro preprocessor that handles your include. Use the
C preprocessor.
 
R

Roedy Green

If you insist in making your life really miserable,
then there is nothing
to prevent you from either using cpp or m4, like
in a C program. Except you have to call cpp
yourself, because javac will not do this for you.-)

I do some simple things like embed the name of the compiler used by
simply copying one of two variants to the official java file just
prior to compilation. You can do slightly more elaborate things with
simple file concatenation.

As a simple antipiracy measure, and as a very flexible configuration
tool, I sometimes copy a configuration file written in Java for a
customer to the official configuration then compile, to hard code in
all the constants.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top