I am hardcore Noobie in Java (and Eclipse) and this is my 1st Java code.
I am using VMware Java SDK and I am able to run the Java samples that come with the SDK. In one of the sample codes, I find this line:
import com.vmware.vcloud.sdk.Organization;
And the line in which this class is used is:
for (ReferenceType vdcLink : Organization
.getOrganizationByReference(vcloudClient, orgRef)
.getVdcRefs())
Here I understand how Organization is imported and being used.
Now, I am writing my own code in Eclipse and not able to make “Organization” work. Eclipse is not writing the import (however, Eclipse is auto-writing the import statements for few other methods that I used from the same SDK)
Here is what I did:
I did make sure that I import all the .jar files (that come from the VMware SDK) into Eclipse at Project Properties -> Java Build Path -> Libraries.
I am also running CTRL+Shift+O to arrange the imports.
I have also set Windows > Preferences > "Save Actions" and checked "Organize Imports" so that it will arrange the imports every time I save the program.
However, I am just not able to get Organization work.
So from the sample code (which is working), I copied the below line to my code:
import com.vmware.vcloud.sdk.Organization;
But still it is not working. Needless to say, If I type Organization. and then do a CTRL + Space (to show autocomplete suggestions), it does not show any methods in the pop up.
I am thinking this is somehow related to the setting of the .jar file paths but I’m not sure.
Thanks.
UPDATE:
This is the error I get when I use “Organization”: This error pops up in a box when I move my mouse cursor to the Red dot on the far left of the line where I wrote Organization:
Multiple Markers At this line
-Orgnization cannot be resolved to a variable
So,
I got it working as below. Not sure whether it makes any sense to you guys. But an explanation would be really helpful:
My sample code has below things:
In Eclipse, it is located in
project->src->com->vmware->vcloud->sdk->samplesfolderAnd it has this line at the top:
package com.vmware.vcloud.sdk.samples;So I move my code from
project->srctoproject->src->com->vmware->vcloud->sdk->samplesand added that package line to my code.Now eclipse is writing the import statement for
Organizationas well as eclipse shows me available methods forOrganization.Now,
I don’t want to write my code inside the samples folder.
Is this even making any sense??
Thanks for the comments. I got this idea after reading your comments.