Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 3rd, 2009, 5:48 PM   #1
amragman
Genemesis
 
amragman's Avatar
 
Join Date: Jul 2009
Posts: 44
Rep Power: 0 amragman is on a distinguished road
Re: Include library

Quote:
Originally Posted by navi2000 View Post
Hi, I'm new to Java and I would like to know if there is a C-style include functionality in Java.

In C/C++ you could tell compiler that must include all files in a given folder. These files will be compiled together with your project.

In Java, I'm using Netbeans and this functionality seems not to be present. You can add a folder (project properties/libraries), but the files must be pre-compiled (class files, not Java files).

My intention is to have a separate set of java files that many projects can include at convenience, so if I change anything in these set of files and recompile a project, it will be reflected automatically.
In Java we use import keyword to include library files.
Syntax is import java.io.*;

If you want to use your own files as library files first make sure they are compiled then put them in appropriate folder and use it like this

import foldername.filename;

For more please use Google.
__________________
Genemesis
amragman is offline   Reply With Quote
Old Jul 3rd, 2009, 6:50 PM   #2
navi2000
Newbie
 
Join Date: Jul 2009
Posts: 3
Rep Power: 0 navi2000 is on a distinguished road
Re: Include library

Quote:
Originally Posted by amragman View Post
In Java we use import keyword to include library files.
Syntax is import java.io.*;

If you want to use your own files as library files first make sure they are compiled then put them in appropriate folder and use it like this

import foldername.filename;

For more please use Google.
I'm not talking about to use a Java source file from another source file. I'm talking about include a folder with several Java files to the project that will be compiled at the same time the project files will.

For instance, when I create a new Java project, NB creates a structure with a folder "src" where my Java files will be put. I want to include an additional folder outside my project (i.e. ../common/src). In C it's easy changing a project setting and I would like to know if it is as easy or it's not possible to do it.
navi2000 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
error cant include file squills C++ 3 May 8th, 2009 6:16 PM
How to build a self-dependent library file cu2nite C++ 1 Sep 1st, 2008 11:24 PM
Graphics Library? grimpirate PHP 0 Aug 23rd, 2008 3:34 PM
Discussion: How to implement the 'glue' between app and a library? Eoin C++ 10 Sep 28th, 2006 8:14 AM
Dev-C++ - #include .cpp/.h files Cache C++ 5 Nov 25th, 2005 11:34 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:34 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC