How can I automatically start vmware tools?
64
This worked for me on Lubuntu 17.04 (Zesty):
- Open the menu, and under Preferences click Default applications for LXSession.
- Select Autostart from the pane on the left.
- Enter
/usr/bin/vmware-user
in the Manual autostarted applications box, then click + Add. - Reboot, and you should see the window at the correct size.
Related videos on Youtube
Author by
Yves Calaci
Updated on September 18, 2022Comments
-
Yves Calaci almost 2 years
I have a quite simple problem, yet a very weird behaviour on which a
Set
does not delete elements ontrue
predicates for some reason.The entities (for reference only, as this does not have anything to do with the set item - or shouldn't):
@Data @MappedSuperclass @EqualsAndHashCode(of = "uuid") public abstract class Model<ID> { @Id @GeneratedValue protected ID id; protected UUID uuid; // Hybrid model @PrePersist private void onPersisting() { uuid = UUID.randomUUID(); } } @Data @Entity @NoArgsConstructor @EqualsAndHashCode(callSuper = true, of = "name") @Table(uniqueConstraints = @UniqueConstraint(name = "scope_name", columnNames = "name")) public class Scope extends Model<Long> { private String name; public Scope(UUID uuid) { this.uuid = uuid; } public Scope(String name) { this.name = name; } } @Data @Entity @NoArgsConstructor @EqualsAndHashCode(callSuper = true, of = "name") @Table(uniqueConstraints = @UniqueConstraint(name = "role_name", columnNames = "name")) public class Role extends Model<Long> { private String name; @ManyToMany(cascade = { CascadeType.PERSIST, CascadeType.MERGE }) @JoinTable(name = "role_scopes", joinColumns = @JoinColumn(name = "role_id"), inverseJoinColumns = @JoinColumn(name = "scope_id")) private Set<Scope> scopes = new HashSet<>(); public Role(UUID uuid, Scope... scopes) { this.scopes = Stream.of(scopes).collect(Collectors.toSet()); this.uuid = uuid; } public Role(String name, Scope... scopes) { this.scopes = Stream.of(scopes).collect(Collectors.toSet()); this.name = name; } }
The following snippet, called within a JUnit test case, does not delete the set elements (simplified for readability):
@Transactional public Role create(Role role) { role.getScopes().removeIf(unused -> true); // <---- return role; }
For some reason, that snippet does work:
Set<String> strings = new HashSet<>(); strings.add("FOO"); strings.add("BAR"); strings.removeIf(unused -> true);
What's going on here?
-
HEKTO over 8 yearsMy Xubuntu VM was able to start VMTools automatically, but after upgrade to the 14.04.3 it can't do that anymore - so I have to run the
sudo /usr/bin/vmware-user
manually (which is annoying). I'd like to see a good answer to this question as well. One of answers below is for different question apparently, and another one doesn't work for me. -
Andy Turner over 3 yearsIs
getScopes()
returning a defensive copy? -
Yves Calaci over 3 years@matt I'm debugging and yes, Role::getScopes does return a
Set
through Lombok's@Data
. -
Yves Calaci over 3 years@AndyTurner do you mind to explain?
-
Andy Turner over 3 years@Henri is it, for example, returning
new HashSet<>(scopes)
rather thanscopes
? -
Yves Calaci over 3 years@AndyTurner It returns the set itself. See projectlombok.org/features/delombok
-
Andy Turner over 3 years@Henri I'm not sure what I'm meant to be looking at on that page. What happens if you invoke
role.getScopes().removeIf(unused -> true)
directly inside your unit test? Does that remove things as you'd expect? What is the return value? -
Yves Calaci over 3 years@AndyTurner delomboking shows the implicit Lombok's getter (and setter) algorithm, on which you were asking me about. Calling
Set::removeIf
within the unit test does not remove the elements either. -
matt over 3 yearsYou're using Collectors.toSet that isn't necessarily modifiable.
-
Yves Calaci over 3 years@matt that was my only guess, although calling
Set::clear
does modify the set. By the way,Collectors.toSet
shouldn't return an unmodifiable set, as there's a function for this (Collectors.toUnmodifiableSet
). I've ran out of assumptions. -
matt over 3 years@Henri for toSet it says there isn't a guarantee in the documentation. I would replace it with, toCollection and use a HashSet as a test.
-
Andy Turner over 3 years@matt if the returned collection didn't support removal, it would throw an exception when you attempted to remove from it.
-
Andy Turner over 3 years@Henri and what about the return value from
removeIf
? -
Yves Calaci over 3 years@matt indeed, whats strange, though, is that changing from
Stream.of(scopes).collect(Collectors.toSet())
tonew HashSet<>(Arrays.asList(scopes))
onRole
constructor, does not solve this either. Very weird. -
Yves Calaci over 3 years@AndyTurner it returns true.. wtf.
-
matt over 3 yearsHow are you verifying that the items are not being removed? By using the debugger?
-
Andy Turner over 3 years@Henri that would suggest that
role.getScopes() != role.getScopes()
. -
Yves Calaci over 3 years@AndyTurner why would that suggest
role.getScopes() != role.getScopes()
?Role::getScopes
returns thescopes
memory address, not a new one. What's your point?
-
-
rss81 almost 9 yearsthere is no vmx file on the linux side. could you explain what you mean?
-
Prashant Chikhalkar almost 9 yearshave to checked this ? help.ubuntu.com/community/VMware/Tools
-
HEKTO over 8 yearsThe solution with
Application Autostart
doesn't work for me.