This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 18735 - Working directory not set for execution/debugging
Summary: Working directory not set for execution/debugging
Status: VERIFIED WORKSFORME
Alias: None
Product: platform
Classification: Unclassified
Component: Window System (show other bugs)
Version: 3.x
Hardware: All All
: P4 blocker (vote)
Assignee: rmatous
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-12-17 15:54 UTC by Erik Kovach
Modified: 2008-12-22 23:04 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
content of Projects folder (51.89 KB, application/octet-stream)
2001-12-20 15:02 UTC, Jan Zajicek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Erik Kovach 2001-12-17 15:54:43 UTC
I have created two projects that have their Working Directory properties (Tools->Options, the Debugging and Executing->ExecutionTypes->External 
Execution->Expert tab, the Debugger Execution->Expert tab and the Debugger Types->Default Debugging->Expert tab) set correctly but when 
executed 
or debugged are still executng in the NetBeans IDE directory.  I'm sure I've tried all possible caveats listed in the NetBeans FAQ (I am running JDK 
1.3.1_01 and that is the VM reported by NetBeans in the NetBeans About dialog's detail tab, my main class is set to use external execution, etc.).  I 
have confirmed that the directory is not set by printing the System.getProperty("user.dir") value at startup.

I have one project that I imported from my NetBeans 3.2.1 RC 2 settings that has these setting set properly that works correctly (runs from the 
execution directory that I have specified).

I also understand that writing code that depends on such a directory setting is really nota good idea so I am submitting a related project change idea 
to 
my supervisor to hopefully circumvent the need for this in the future as suggested by the NetBeans FAQ.

Here is the related NetBeans FAQ link on the concept:
http://www.netbeans.org/articles/faqs/configuration.html#FAQ_41
Comment 1 Jan Zajicek 2001-12-18 11:29:19 UTC
I tried to set the working directory and then executed the ImageViewer
from sampledir in Default project. Everything worked as expected.
Please, do you see the same problems in this simple scenario on your
side too? Thanks.
Comment 2 Jan Zajicek 2001-12-19 14:03:47 UTC
Additional comments (please add comments to the issue don't just reply
to the emails from IssueZilla):

No, still no-go.  I performed the following steps:

* Deleted my NetBeans 3.3 settings directory (I had deleted the Default
project so I did this to "reset" things)

* Started NetBeans 3.3 and imported my preferences from NetBeans 3.2.1RC2
(different personal directory, though, so I can still run NetBeans
3.2.1RC2
if I need to); Project Default is the starting project at startup

* Added the imageviewer to the Project by right-clicking on "Project
Default" and selecting Add Existing...

* Right-clicked on the ImageViewer class and selected Tools->Set As
Project
Main Class.

* Selected Tools->Options from the menu and set the following Properties
(yes, D:\Downloads exists as a directory):

    Debugging and Executing
        Debugger Types
            Default Debugging
                (Expert Tab) Working Directory = D:\Downloads
        Execution Types
            External Execution
                (Expert Tab) Working Directory = D:\Downloads
            Debugger Execution
                (Expert Tab) Working Directory = D:\Downloads

I then executed the project, which compiled the code and brought up the
Image Viewer.  I then selected File and Open and the current directory was
D:\NetBeans-3.3\bin (the NetBeans runtime driectory).  The same occurs
when
I debug the project.

I also checked the Properties of the ImageViewer class.  In the Expert tab
the following is set:
    Compiler = External Compilation
    Debugger = Default Debugging
    Executor = External Execution

I also tried this from scratch WITHOUT importing my settings and it still
did not work.

Thanks for the quick feedback on this, by the way.

Voch

Comment 3 Jan Zajicek 2001-12-19 14:05:04 UTC
Next comment:

I have more information on this problem as I have reproduced it on my
boss'
machine with one project working properly and another not working.

My boss is running NetBeans 3.3 and has two projects: CodeDrop-1024 and
CurrentBuild.  The CodrDrop-1024 project has the following Tools->Options
settings:

    Debugging and Executing
        Debugger Types
            Default Debugging
                (Expert Tab) Working Directory = D:\CodeDrop-1024
        Execution Types
            External Execution
                (Expert Tab) Working Directory = D:\CodeDrop-1024
            Debugger Execution
                (Expert Tab) Working Directory = D:\CodeDrop-1024

And the CurrentBuild project has these Tools->Options settings:

    Debugging and Executing
        Debugger Types
            Default Debugging
                (Expert Tab) Working Directory = D:\CurrentBuild
        Execution Types
            External Execution
                (Expert Tab) Working Directory = D:\CurrentBuild
            Debugger Execution
                (Expert Tab) Working Directory = D:\CurrentBuild

He created the project CodeDrop-1024 first and set it up.  It executes and
debugs the project from the directories specified in the Tools->Options
dialog properly.

Next he created the project CurrentBuild.  It executes and debugs the
project INCORRECTLY setting the working directory to those of the the
CodeDrop-1024 project.  The values are consistent and seemingly saved
properly when edited and retrieved in the Tools->Options dialog for both
projects.

If I may wager a guess I think either the executor/debugger is reading the
information from the wrong project OR the Tools->Options dialog is reading
and writing the infromation to and from the wrong project consistently and
the executor/debugger is reading it properly.

Voch

Comment 4 Jan Zajicek 2001-12-19 14:12:43 UTC
I again wasn't successful in reproduction. Anyway, is it possible to
attach zipped {userdir}/system/Projects directory, so we can check
saved settings. CCing Vita, he will know about settings stuff more.
Comment 5 Jan Zajicek 2001-12-20 15:02:25 UTC
Created attachment 3908 [details]
content of Projects folder
Comment 6 Gordon Mohr 2001-12-29 10:09:20 UTC
I'm having this same problem. Windows XP, NetBeans 3.3 
(b200112102331), Java 1.3.1.

Creating a trivial class with a main which simply does...

    System.out.println(System.getProperty("user.dir"))

...shows the the "Working Directory" property of the "External
Execution" > Expert tab has no effect on executing the class.

A potentially relevant fact: I deleted the "Default Project" 
from the Project Manager a while back.
Comment 7 Jan Chalupa 2002-01-11 14:00:21 UTC
Target milestone -> 3.4
Comment 8 Jan Chalupa 2002-01-11 14:04:25 UTC
Target milestone -> 3.4
Comment 9 Jan Chalupa 2002-01-11 14:06:03 UTC
Target milestone -> 3.4
Comment 10 Jan Chalupa 2002-01-11 14:09:56 UTC
Target milestone -> 3.4
Comment 11 Jan Pokorsky 2002-01-21 17:16:36 UTC
It works for me too. Attached userdir contains just Default project 
where the working directory is set as D:\Downloads for External 
Executor.

Try to reproduce with the latest nb3.3.1 build, follow steps mentioned 
by Gordon and if the problem remains reopen the bug please.
Comment 12 radhika2 2002-06-03 21:43:54 UTC
Seems like this issue is occuring again: Here's more information from
a customer:
This occurs after an update (patch ) to version 3.0 that was installed
via auto-update.  

Having read the bug report from the original report, I would suggest
that the update is probably a red-herring and that this is an
intermitent fault that I had just not encountered before.  I would
suggest that this bug is real, although not reproducable by you (I
have opened some other projects that I had lying around and proved
that they do not suffer from this problem). 

==========================================================
New update, working directory setting ignored by debgger.
bin as the working directory, regardless of the setting of working
directory in the project|settings|execution types|debugging|expert
dialog.

Executing the project works correctly and the execution types setting
for working directory is the same.  This problem did not exist before
the latest update.

I selected the working directory setting from the file selction
dialog in all cases, so this is not a difficult to spot typing error.
Comment 13 Marek Grummich 2002-07-22 08:55:45 UTC
Target milestone was changed from '3.4' to TBD.
Comment 14 Marek Grummich 2002-07-22 09:01:36 UTC
Target milestone was changed from '3.4' to TBD.
Comment 15 Marek Grummich 2002-07-22 09:01:55 UTC
Target milestone was changed from '3.4' to TBD.
Comment 16 Marek Grummich 2002-07-22 09:29:26 UTC
Target milestone was changed from '3.4' to TBD.
Comment 17 rmatous 2003-07-04 15:43:15 UTC
Tested and seems, that works for me. 
Comment 18 Marian Mirilovic 2003-07-29 09:49:39 UTC
verified - it works fine in [nb_dev](20030728)