# Custom Java Components - Accessing Workspace Directory

**URL:** <https://forum.cloverdx.com/t/custom-java-components-accessing-workspace-directory/2104>\
**Category:** CloverDX Platform\
**Created:** [January 19, 2021, 12:00am UTC](https://forum.cloverdx.com/t/custom-java-components-accessing-workspace-directory/2104 "2021-01-19T00:00:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pfield](https://avatars.discourse-cdn.com/v4/letter/p/8dc957/32.png) [@pfield](https://forum.cloverdx.com/u/pfield)\
**Post date:** [January 19, 2021, 12:00am UTC](https://forum.cloverdx.com/t/custom-java-components-accessing-workspace-directory/2104/1 "2021-01-19T00:00:00Z")

</div>

Hi,

I have a Custom Java Component that collects a file from my project workspace for processing based on an input port field value. Everything works fine, however, in order to access the file I need to provide the full file path from my C Drive despite the file sitting in a project directory. This is inconvenient as if I ever move the component to a different project I would need to rekey in the project location.

Here is a snippet of my current code

```auto
String WorkingFolder = "C:/Users/<My User>/clover_workspace/<clover project>";
		String Dir = getProperties().getStringProperty("Directory");
		
		DataRecord inRecord = inRecords[0];
		DataRecord outRecord = outRecords[0];
		
		while ((inRecord = readRecordFromPort(0)) != null) {
			
			String fileUrl = WorkingFolder+Dir+inRecord.getField(0).getValue().toString();
...

```

Is there a more elegant way to achieve this? I tried using the project Graph Parameter via _graph.getGraphParameters()_ but it returns “.” as opposed to the full file path.

Thanks,  
Paul

---

<div class="post-metadata">

**Author:** ![pfield](https://avatars.discourse-cdn.com/v4/letter/p/8dc957/32.png) [@pfield](https://forum.cloverdx.com/u/pfield)\
**Post date:** [January 20, 2021, 11:04am UTC](https://forum.cloverdx.com/t/custom-java-components-accessing-workspace-directory/2104/2 "2021-01-20T11:04:37Z")

</div>

Hi,

After some more exploration of the graph parameters I found SANDBOX\_ROOT which gives me the path I was looking for.

```auto
String WorkingFolder = getGraph().getGraphParameters().getGraphParameter("SANDBOX_ROOT").getValue();

```

Paul

---

<div class="post-metadata">

**Author:** ![David\_Hlidek](https://avatars.discourse-cdn.com/v4/letter/d/58f4c7/32.png) [@David\_Hlidek](https://forum.cloverdx.com/u/David_Hlidek)\
**Post date:** [January 25, 2021, 8:34am UTC](https://forum.cloverdx.com/t/custom-java-components-accessing-workspace-directory/2104/3 "2021-01-25T08:34:52Z")

</div>

Hi Paul,

Yes, the SANDBOX\_ROOT parameter is exactly what I would suggest in your case. You can find the list of parameters on the following page:  
[https://doc.cloverdx.com/latest/server/graph-parameters.html](https://doc.cloverdx.com/latest/server/graph-parameters.html)  
Please don’t get confused by the fact that this documentation page points to the Server related topic. These parameters can be all used by the Designer as well.

Have a nice day, Eva
