How to include new environment variables in Mx Linux?

Help for Current Versions of MX
When asking for help, use Quick System Info from MX Tools. It will be properly formatted using the following steps.
1. Click on Quick System Info in MX Tools
2. Right click in your post and paste.
Message
Author
User avatar
zsoldier
Posts: 26
Joined: Wed Aug 14, 2024 2:56 pm

How to include new environment variables in Mx Linux?

#1 Post by zsoldier »

empty
Last edited by zsoldier on Sat Oct 12, 2024 12:14 am, edited 1 time in total.

User avatar
MikeR
Posts: 195
Joined: Sun Jun 25, 2023 6:42 am

Re: How to include new environment variables in Mx Linux?

#2 Post by MikeR »

try
https://duckduckgo.com/?t=ffab&q=Eclips ... 6-1&ia=web
and choose one of the options displayed

HTH
Old RSTS hack
Registered Linux user #542196

User avatar
timkb4cq
Developer
Posts: 3553
Joined: Wed Jul 12, 2006 4:05 pm

Re: How to include new environment variables in Mx Linux?

#3 Post by timkb4cq »

I've always used ~/.bashrc to add that kind of variable, but ~/.profile should work as well
The issue might be missing quote marks. I've needed them. Try

Code: Select all

JAVA_HOME="/usr/lib/jvm/java-oracle/"
export JAVA_HOME
HP Pavillion TP01, AMD Ryzen 3 5300G (quad core), Crucial 500GB SSD, Toshiba 6TB 7200rpm
Dell Inspiron 15, AMD Ryzen 7 2700u (quad core). Sabrent 500GB nvme, Seagate 1TB

User avatar
zsoldier
Posts: 26
Joined: Wed Aug 14, 2024 2:56 pm

Re: How to include new environment variables in Mx Linux?

#4 Post by zsoldier »

MikeR wrote: Tue Aug 20, 2024 3:34 am try
https://duckduckgo.com/?t=ffab&q=Eclips ... 6-1&ia=web
and choose one of the options displayed

HTH

I thought it was well explained in the question, I said that I want to insert the environment variable mentioned in the 1st post above in the .profile or /etc/profile file, this and modifying the PATH variable to include eclipse the eclipse executables. I'm not asking how to handle or write java to the file, that's simple. The problem is that Mx Linux filters changes to the PATH and it is not possible to modify it.

User avatar
timkb4cq
Developer
Posts: 3553
Joined: Wed Jul 12, 2006 4:05 pm

Re: How to include new environment variables in Mx Linux?

#5 Post by timkb4cq »

zsoldier wrote: Tue Aug 20, 2024 10:32 pm ,,,The problem is that Mx Linux filters changes to the PATH and it is not possible to modify it.
Not true. But you have to use quotes. For example, this is part of my .bashrc file and works just fine

Code: Select all

if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

Code: Select all

$ echo $PATH
/home/tim/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
HP Pavillion TP01, AMD Ryzen 3 5300G (quad core), Crucial 500GB SSD, Toshiba 6TB 7200rpm
Dell Inspiron 15, AMD Ryzen 7 2700u (quad core). Sabrent 500GB nvme, Seagate 1TB

User avatar
Eadwine Rose
Administrator
Posts: 14424
Joined: Wed Jul 12, 2006 2:10 am

Re: How to include new environment variables in Mx Linux?

#6 Post by Eadwine Rose »

Moved to help forum. There was no tip or trick shared. Please be mindful where you post.
MX-23.6_x64 July 31 2023 * 6.1.0-34amd64 ext4 Xfce 4.20.0 * 8-core AMD Ryzen 7 2700
Asus TUF B450-Plus Gaming UEFI * Asus GTX 1050 Ti Nvidia 535.216.01 * 2x16Gb DDR4 2666 Kingston HyperX Predator
Samsung 870EVO * Samsung S24D330 & P2250 * HP Envy 5030

User avatar
DukeComposed
Posts: 1283
Joined: Thu Mar 16, 2023 1:57 pm

Re: How to include new environment variables in Mx Linux?

#7 Post by DukeComposed »

zsoldier wrote: Tue Aug 20, 2024 10:32 pm The problem is that Mx Linux filters changes to the PATH and it is not possible to modify it.
That isn't true and you haven't given any indication to the contrary.

I think you need to learn a thing or two about how shells work and how to export environment variables before you make a conclusive decision like this in the future.

User avatar
zsoldier
Posts: 26
Joined: Wed Aug 14, 2024 2:56 pm

Re: How to include new environment variables in Mx Linux?

#8 Post by zsoldier »

DukeComposed wrote: Wed Aug 21, 2024 3:45 am
zsoldier wrote: Tue Aug 20, 2024 10:32 pm The problem is that Mx Linux filters changes to the PATH and it is not possible to modify it.
That isn't true and you haven't given any indication to the contrary.

I think you need to learn a thing or two about how shells work and how to export environment variables before you make a conclusive decision like this in the future.
Look for something to do, don't understand the problem, don't know the subject, don't write nonsense.

User avatar
DukeComposed
Posts: 1283
Joined: Thu Mar 16, 2023 1:57 pm

Re: How to include new environment variables in Mx Linux?

#9 Post by DukeComposed »

zsoldier wrote: Thu Aug 22, 2024 12:36 am Look for something to do, don't understand the problem, don't know the subject, don't write nonsense.
You don't even see the solution when I've put it right in front of you.

User avatar
LinuxSpring1
Posts: 274
Joined: Sun May 05, 2024 8:57 am

Re: How to include new environment variables in Mx Linux?

#10 Post by LinuxSpring1 »

@zsoldier the response given by @timkb4cq should work for you. You have not explained why you need the variable JAVA_HOME in the .profile file and not in the .bashrc. I am assuming that you need start Eclipse by using the terminal.

If you are using KDE then you can create a shortcut to start Eclipse on the desktop. Right click on the desktop and select the option, Create New > Link to Application. There in the third tab Application you can choose the program (i.e. link to where eclipse is installed), and also give Environment Variables like JAVA_HOME.

If you do not want to do this or do not use KDE then in the shortcut or shell script that you use to start Eclipse you can give the following two options
-vm <path to java vm. Typically present in JRE/BIN>
-vmargs <The arguments that will be passed to Java VM for example minimum/maximum heapsize, -server or -client vm to use and so on>
Please refer to the Eclipse help for more details. Also look at Eclipse Launcher.
You can have multiple shell script for different VMs for eclipse to use say one for JAVA 8, one for JAVA 17, one for JAVA 16 and so on.
You can put this in eclipse.ini file

And finally please refrain from saying what you told @DukeComposed a few post ago. Politeness goes a long way.

Post Reply

Return to “MX Help”