Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Tools / January 2005

Tip: Looking for answers? Try searching our database.

Netbeans 4.0 and classpath

Thread view: 
Mark Murphy - 02 Jan 2005 06:40 GMT
Hi all,
I recently moved from NB3.6 to NB4.0 and now I have a question about how
NB4.0 handles classpaths. In NB3.6 I used "getClass().getResource()" to
build the URL to a couple of images I needed to load. In NB3.6 I was
able to place the images inside the Jar or in the same directory as the
jar. In NB4.0 it will only load if the images are in the Jar.  Since I
need to change the image without altering the Jar this does not work for
me.

So looking at this it looks like ".;" was dropped from the classpath.
Hence my question. How do I add ".;" to the classpath for the built Jar
file. I know I can right click and alter the properties, but when I do
that and enter "." I get the current directory listed as the class path
. rather than ".;"

Hope this is clear enough

Thanks
Mark
Rogue - 03 Jan 2005 09:03 GMT
Hi Mark,
I think what you need to do is set your working directory to the
directory containing the root directory holding the path to the images.
Meaning if you have the following structure:
[root]
|->[images]
|-> img01.jpg
,
and you do a getClass().getResource("images/img01.jpg"); then you need
to set the working directory to [root] . You can set the working
directory by going to the project properties -> running project.
I hope this helps.

thanks,
Rogue
Mark@Murphy.net - 03 Jan 2005 21:04 GMT
> Hi Mark,
> I think what you need to do is set your working directory to the
[quoted text clipped - 3 lines]
> thanks,
> Rogue

Rogue-

Thanks for responding but that did not turn out to be the problem.

I did notice a diffence between the code I but I'm not sure if it will
address the issue. I'll have to play around with it. In my code for
Nd3.6 I had the main class is outside of the any packages. {.Main} It
seems NB4 puts the main class in {<project>.Main}.

But my bigger problem is outside of the IDE. Within the IDE I can place
the resource files in locations that the IDE will see for development.
But the Jar file that is created by the IDE is not looking in the "."
directory.

(example folder structure for final project)
folder
-><project>.jar
->Image.jpg

Do you know how I can change to classpath for the created Jar file to
include "."

Thanks again
Mark


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.