Results 1 to 5 of 5

Thread: Running Java as User not Root

  1. #1

    Default Running Java as User not Root

    I know I should know this. I have just downloaded a java .jar application and it is sitting in my Downloads directory with permissions

    [QUOTE-rw-r----- 1][/QUOTE].

    I can run it as root from the Downloads directory but what is the correct way to run it as me and the correct directory in which to put such programs. How can I run a downloaded java application as me, a user, and not as root? Is it just changing permissions or should I change ownership? Should the .jar file be an executable as well? Can a java file be an executable?
    Sorry to ask such basic questions but I need to get these thinks right and have fudged it till now!!!

  2. #2
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,164

    Default Re: Running Java as User not Root

    When you have downloaded it in your GUI, you will be the owner. And you are able to run it. Of course root can run it (if it is runable at all), but why would you try that or even want to try that. It is you, the normal user that downloaded it. Did you try to run it (because you do not say so)?

    Show us an
    Code:
    ls -l
    of the file.

    I know you showed some misshapen part of that, but why not the whole line?
    Henk van Velden

  3. #3
    Join Date
    Sep 2008
    Posts
    2,997

    Default Re: Running Java as User not Root

    What DE are you using, I believe kde and gnome have propper mime settings for jar files but seeing how jar's are regular zip's some archiver's might take over jar handling. In dolphin when you right-click on a jar do you have an option open with java?
    In principle jar's can be run from the command line
    Code:
    #java -jar <jarfile>.jar
    how do you run it as root?

  4. #4
    Join Date
    Sep 2008
    Posts
    2,997

    Default Re: Running Java as User not Root

    had a similar issue today
    it seams ark takes over jar files handling,
    a quick fix:
    In open with -> other
    type java -jar
    check remember application...
    now there's an option to run jar files in a java virtual machine
    if you'd like to make this more permanent and have all jar's open with a java virtual machine
    see kde's Configure Desktop -> File Assosiation

  5. #5
    Join Date
    Sep 2008
    Posts
    2,997

    Default Re: Running Java as User not Root

    Quote Originally Posted by Budgie2 View Post
    I know I should know this. I have just downloaded a java .jar application and it is sitting in my Downloads directory with permissions

    -rw-r----- 1]
    .

    I can run it as root from the Downloads directory but what is the correct way to run it as me and the correct directory in which to put such programs. How can I run a downloaded java application as me, a user, and not as root? Is it just changing permissions or should I change ownership? Should the .jar file be an executable as well? Can a java file be an executable?
    Sorry to ask such basic questions but I need to get these thinks right and have fudged it till now!!!
    That would be the $CLASSPATH directory, execute
    Code:
    echo $CLASSPATH
    to get the right dir, if you get a not defined error or no directory then it's java's default ext dir and that depends on the version of java you have installed, on the default openJDK 1.8 that dir would be
    /usr/lib/jvm/java-1.8.0-openjdk-1.8.0/jre/lib/ext/
    you should note that you can change that dir eather by defining the $CLASSPATH variable or using the -cp switch

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •