How can I automatically start vmware tools?

64

This worked for me on Lubuntu 17.04 (Zesty):

  1. Open the menu, and under Preferences click Default applications for LXSession.
  2. Select Autostart from the pane on the left.
  3. Enter /usr/bin/vmware-user in the Manual autostarted applications box, then click + Add.
  4. Reboot, and you should see the window at the correct size.
Share:
64

Related videos on Youtube

Yves Calaci
Author by

Yves Calaci

Updated on September 18, 2022

Comments

  • Yves Calaci
    Yves Calaci almost 2 years

    I have a quite simple problem, yet a very weird behaviour on which a Set does not delete elements on true 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
      HEKTO over 8 years
      My 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
      Andy Turner over 3 years
      Is getScopes() returning a defensive copy?
    • Yves Calaci
      Yves Calaci over 3 years
      @matt I'm debugging and yes, Role::getScopes does return a Set through Lombok's @Data.
    • Yves Calaci
      Yves Calaci over 3 years
      @AndyTurner do you mind to explain?
    • Andy Turner
      Andy Turner over 3 years
      @Henri is it, for example, returning new HashSet<>(scopes) rather than scopes?
    • Yves Calaci
      Yves Calaci over 3 years
      @AndyTurner It returns the set itself. See projectlombok.org/features/delombok
    • Andy Turner
      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
      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
      matt over 3 years
      You're using Collectors.toSet that isn't necessarily modifiable.
    • Yves Calaci
      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
      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
      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
      Andy Turner over 3 years
      @Henri and what about the return value from removeIf?
    • Yves Calaci
      Yves Calaci over 3 years
      @matt indeed, whats strange, though, is that changing from Stream.of(scopes).collect(Collectors.toSet()) to new HashSet<>(Arrays.asList(scopes)) on Role constructor, does not solve this either. Very weird.
    • Yves Calaci
      Yves Calaci over 3 years
      @AndyTurner it returns true.. wtf.
    • matt
      matt over 3 years
      How are you verifying that the items are not being removed? By using the debugger?
    • Andy Turner
      Andy Turner over 3 years
      @Henri that would suggest that role.getScopes() != role.getScopes().
    • Yves Calaci
      Yves Calaci over 3 years
      @AndyTurner why would that suggest role.getScopes() != role.getScopes()? Role::getScopes returns the scopes memory address, not a new one. What's your point?
  • rss81
    rss81 almost 9 years
    there is no vmx file on the linux side. could you explain what you mean?
  • Prashant Chikhalkar
    Prashant Chikhalkar almost 9 years
  • HEKTO
    HEKTO over 8 years
    The solution with Application Autostart doesn't work for me.