-1

I'm running Linux Mint 18.3 cinnamon 64 bits

I just downloaded Apache NetBeans IDE 9.0

It wasn't necessary to run any script to install it, i just had to run the following command to launch it: sudo /opt/netbeans/bin/netbeans Then enter my password and netbeans opens. Then i made a launcher for the program because i didn't want to type the command and my password every time i open netbeans. But the launcher didn't worked. I realize that i didn't put "sudo" in the command that the launcher would execute so i put it. And didn't work.

I thought that it wasn't working because the launcher executes sudo /opt/netbeans/bin/netbeans but don't put the password. After some research i end up adding star_man ALL=(ALL) NOPASSWD: /opt/netbeans/bin/netbeans at the end of /etc/sudoers and it finally works. But when i create a new project Netbeans sets root as the author of every file it creates.

For example, when i type ls -l in my project directory it outputs this:

-rw-r--r-- 1 root root 3527 sep 15 20:01 build.xml
-rw-r--r-- 1 root root   82 sep 15 20:01 manifest.mf
drwxr-xr-x 3 root root 4096 sep 15 20:01 nbproject
drwxr-xr-x 3 root root 4096 sep 15 20:01 src

Root is the group and the owner of every file an directory.

This causes that when Netbeans generates documentation files it put "root" instead my username.

Update: I only can start neatbeans as root (sudo ./netbeans).

when i run neatbean without sudo from the terminal it looks like it's starting:screen shot

but then it closes.

This is the output:

>Log Session: Sunday, September 16, 2018 at 12:58:20 PM Eastern Daylight Time
>System Info: 
  Product Version         = Apache NetBeans IDE 9.0 (Build incubator-netbeans-release-334-on-20180708)
  Operating System        = Linux version 4.15.0-34-generic running on amd64
  Java; VM; Vendor        = 10.0.1; Java HotSpot(TM) 64-Bit Server VM 10.0.1+10; Oracle Corporation
  Runtime                 = Java(TM) SE Runtime Environment 10.0.1+10
  Java Home               = /opt/java/jdk-10.0.1
  System Locale; Encoding = es_DO (nb); UTF-8
  Home Directory          = /home/star_man
  Current Directory       = /opt/netbeans
  User Directory          = /home/star_man/.netbeans/9.0
  Cache Directory         = /home/star_man/.cache/netbeans/9.0
  Installation            = /opt/netbeans/nb
                            /opt/netbeans/ide
                            /opt/netbeans/extide
                            /opt/netbeans/java
                            /opt/netbeans/apisupport
                            /opt/netbeans/websvccommon
                            /opt/netbeans/profiler
                            /opt/netbeans/harness
                            /opt/netbeans/javafx
                            /opt/netbeans/platform
  Boot & Ext. Classpath   = 
  Application Classpath   = /opt/netbeans/platform/lib/boot.jar:/opt/netbeans/platform/lib/org-openide-modules.jar:/opt/netbeans/platform/lib/org-openide-util.jar:/opt/netbeans/platform/lib/org-openide-util-lookup.jar:/opt/netbeans/platform/lib/org-openide-util-ui.jar
  Startup Classpath       = /opt/netbeans/platform/core/core-base.jar:/opt/netbeans/platform/core/org-netbeans-libs-asm.jar:/opt/netbeans/platform/core/asm-all-5.0.1.jar:/opt/netbeans/platform/core/org-openide-filesystems.jar:/opt/netbeans/platform/core/org-openide-filesystems-compat8.jar:/opt/netbeans/platform/core/core.jar:/opt/netbeans/nb/core/org-netbeans-upgrader.jar:/opt/netbeans/nb/core/locale/core_nb.jar
-------------------------------------------------------------------------------
INFO [org.netbeans.modules.netbinox]: Install area set to file:/opt/netbeans/
!SESSION 2018-09-16 12:58:21.698 -----------------------------------------------
eclipse.buildId=unknown
java.version=10.0.1
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=es_DO

!ENTRY org.eclipse.osgi 4 0 2018-09-16 12:58:21.706
!MESSAGE Error reading configuration: Permission denied
!STACK 0
java.io.IOException: Permission denied
    at java.base/java.io.UnixFileSystem.createFileExclusively(Native Method)
    at java.base/java.io.File.createTempFile(File.java:2090)
    at org.eclipse.osgi.storagemanager.StorageManager.initializeInstanceFile(StorageManager.java:188)
    at org.eclipse.osgi.storagemanager.StorageManager.open(StorageManager.java:708)
    at org.eclipse.osgi.internal.baseadaptor.BaseStorage.initFileManager(BaseStorage.java:226)
    at org.eclipse.osgi.internal.baseadaptor.BaseStorage.initialize(BaseStorage.java:160)
    at org.eclipse.osgi.baseadaptor.BaseAdaptor.initializeStorage(BaseAdaptor.java:123)
    at org.eclipse.osgi.framework.internal.core.Framework.<init>(Framework.java:192)
    at org.eclipse.osgi.framework.internal.core.EquinoxLauncher.internalInit(EquinoxLauncher.java:67)
    at org.eclipse.osgi.framework.internal.core.EquinoxLauncher.init(EquinoxLauncher.java:37)
    at org.eclipse.osgi.launch.Equinox.init(Equinox.java:178)
    at org.netbeans.modules.netbinox.Netbinox.init(Netbinox.java:61)
    at org.netbeans.core.netigso.Netigso.prepare(Netigso.java:145)
    at org.netbeans.NetigsoHandle.turnOn(NetigsoHandle.java:115)
    at org.netbeans.ModuleManager.enable(ModuleManager.java:1331)
    at org.netbeans.ModuleManager.enable(ModuleManager.java:1148)
    at org.netbeans.core.startup.ModuleList.installNew(ModuleList.java:315)
    at org.netbeans.core.startup.ModuleList.trigger(ModuleList.java:251)
    at org.netbeans.core.startup.ModuleSystem.restore(ModuleSystem.java:276)
    at org.netbeans.core.startup.Main.getModuleSystem(Main.java:156)
    at org.netbeans.core.startup.Main.getModuleSystem(Main.java:125)
    at org.netbeans.core.startup.Main.start(Main.java:282)
    at org.netbeans.core.startup.TopThreadGroup.run(TopThreadGroup.java:98)
    at java.base/java.lang.Thread.run(Thread.java:844)
java.lang.RuntimeException: Permission denied
    at org.eclipse.osgi.framework.internal.core.Framework.<init>(Framework.java:194)
    at org.eclipse.osgi.framework.internal.core.EquinoxLauncher.internalInit(EquinoxLauncher.java:67)
    at org.eclipse.osgi.framework.internal.core.EquinoxLauncher.init(EquinoxLauncher.java:37)
    at org.eclipse.osgi.launch.Equinox.init(Equinox.java:178)
    at org.netbeans.modules.netbinox.Netbinox.init(Netbinox.java:61)
    at org.netbeans.core.netigso.Netigso.prepare(Netigso.java:145)
    at org.netbeans.NetigsoHandle.turnOn(NetigsoHandle.java:115)
    at org.netbeans.ModuleManager.enable(ModuleManager.java:1331)
    at org.netbeans.ModuleManager.enable(ModuleManager.java:1148)
    at org.netbeans.core.startup.ModuleList.installNew(ModuleList.java:315)
    at org.netbeans.core.startup.ModuleList.trigger(ModuleList.java:251)
    at org.netbeans.core.startup.ModuleSystem.restore(ModuleSystem.java:276)
    at org.netbeans.core.startup.Main.getModuleSystem(Main.java:156)
    at org.netbeans.core.startup.Main.getModuleSystem(Main.java:125)
    at org.netbeans.core.startup.Main.start(Main.java:282)
    at org.netbeans.core.startup.TopThreadGroup.run(TopThreadGroup.java:98)
    at java.base/java.lang.Thread.run(Thread.java:844)
Caused by: java.io.IOException: Permission denied
    at java.base/java.io.UnixFileSystem.createFileExclusively(Native Method)
    at java.base/java.io.File.createTempFile(File.java:2090)
    at org.eclipse.osgi.storagemanager.StorageManager.initializeInstanceFile(StorageManager.java:188)
    at org.eclipse.osgi.storagemanager.StorageManager.open(StorageManager.java:708)
    at org.eclipse.osgi.internal.baseadaptor.BaseStorage.initFileManager(BaseStorage.java:226)
    at org.eclipse.osgi.internal.baseadaptor.BaseStorage.initialize(BaseStorage.java:160)
    at org.eclipse.osgi.baseadaptor.BaseAdaptor.initializeStorage(BaseAdaptor.java:123)
    at org.eclipse.osgi.framework.internal.core.Framework.<init>(Framework.java:192)
    ... 16 more

I find out that every file and directory under ~/.netbeans has root as owner and group. I thought that might be the problem so i changed the owner and group with ~/.netbeans $ sudo chown -R myusername: .netbeans/. And still i'm only able to run netbeans as root.

Slart42
  • 101
  • 9
  • This seems more like a question for [Super User](http://superuser.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/). – jww Sep 16 '18 at 02:00
  • I don't see why this can't be here – Slart42 Sep 16 '18 at 02:21
  • @LewisMojica Your question is definitely fine here, and it clearly falls in a category that is specifically mentioned in [What topics can I ask about here?](https://stackoverflow.com/help/on-topic): _if your question generally covers…software tools commonly used by programmers; and is a practical, answerable problem that is unique to software development… then you’re in the right place to ask your question!_ – skomisa Sep 16 '18 at 03:17
  • Just to note that two people have (incorrectly) voted to close this question because _"Questions about general computing hardware and software are off-topic for Stack Overflow unless they directly involve tools used primarily for programming"_. This question clearly relates to _**"tools used primarily for programming"**_, so it is on topic. – skomisa Sep 16 '18 at 03:20
  • 2
    This question is not about a programming tool; it's about general unix permissions. – Ipor Sircer Sep 16 '18 at 04:17
  • 1
    @skomisa - You missed the other part: *"and is ... a practical, answerable problem that is unique to software development"*. I think it is a bit of a stretch to claim managing ACLs and setting permissions is unique to software development. – jww Sep 16 '18 at 04:56
  • @jww I didn't miss that part - I specifically and deliberately quoted it. NetBeans is clearly a programming tool, and the poster's issue is specifically **within** NetBeans: _"when i create a new project **NetBeans sets root as the author of every file it creates**"_. I think it is _"a bit of stretch"_ to claim that this problem isn't clearly a NetBeans problem. – skomisa Sep 16 '18 at 05:06

1 Answers1

0

This is a basic unix permissions problem.

For reasons that escape me, you used sudo to launch the netbeans IDE.
- You should not have done that.
- You should not have needed to do that!

When you use sudo to run something, you are typically running as the root user. (That is what sudo does!)

So, naturally, the something (in this case, the netbeans application run using sudo) will create files and directories owned by the "root" user. So when you try to update them as a normal user, the operating system says "Nope: you don't own those files / directories, so you can't modify them.".

Solution: use the chown command to change the ownership of the files and the directories as required.

How? Read man chown, or look for a tutorial on how to change the ownership of a file.

  • Hint: you will need to use sudo when chowning ...
  • Hint 2: be very, very careful when you use sudo, because sudo has the power to trash your system if you make a mistake.
Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
  • Thanks for answering!. I only can run netbean as root (sudo ./netbeans). If i try "./netbeans" it doesn't start. – Slart42 Sep 16 '18 at 16:30
  • I find out that every file under ~/.netbeans has root as owner, so i changed the owner and group from root to my username with chown, but still i only can run it as root – Slart42 Sep 16 '18 at 16:35
  • The partial stacktrace says that your Netbeans is trying to create a temporary file (a lock file probably) in a directory where it doesn't have write permission. Find that directory and fix its ownership and/or permissions. – Stephen C Sep 16 '18 at 22:41
  • Since you are running on Linux, check ~/.netbeans and subdirectories. – Stephen C Sep 16 '18 at 22:45
  • I executed `sudo chown -R myusername: ~/.netbeans` , so the owner of every file and directory under `~/.netbeans` is `myusername`. Still doesn't works. – Slart42 Sep 17 '18 at 03:42
  • Per the full stacktrace, OSGI is trying to create an instance file in the storage manager's MANAGER_FOLDER. Look for a directory called ".manager". I suspect that this is actually in your Netbeans installation directory. Which suggests that the problem is that your Netbeans installation has the wrong owner! – Stephen C Sep 17 '18 at 04:58
  • It works!. I runned `~ $ find | grep -w .manager`. That returned `./.cache/netbeans/9.0/netigso/org.eclipse.equinox.app/.manager` so i runned `~ $ sudo chown -Rc star_man: ./.cache/netbeans/*` to set `myusername` as owner of every file under `~/.cache/netbeans/`. Thaks a lot. – Slart42 Sep 17 '18 at 20:16