From this repository
I try to run the following step
Download Mairesse's tool PersonalityRecognizer and unzip it to the
same location. Check the installation instructions to properly
configure the tool.
However I receive this error:
$ ./PersonalityRecognizer -i ../output_dir -d -t 2 -a ../mairesse_Apache.arff
./PersonalityRecognizer: line 15: ../../apps/jdk1.5.0_05/bin/java: No such file or directory
In this file, which is from the tool, I setted the version of java I have
#echo off
rem WINDOWS LAUNCH SCRIPT
rem ENVIRONMENT VARIABLES TO MODIFY
set JDK_PATH="C:\Program Files\Java\jdk1.8.0_151"
set WEKA="H:\apps\weka-3-4\weka.jar"
rem ----------------------------------
set COMMONS_CLI="lib\commons-cli-1.0.jar"
set JMRC="lib\jmrc.jar"
set LIBS=%WEKA%;%COMMONS_CLI%;%JMRC%;%CD%;bin\
%JDK_PATH%\bin\java -Xmx512m -classpath %LIBS% recognizer.PersonalityRecognizer %1 %2 %3 %4 %5 %6 %7 %8 %9
Why the error shows a different version and path? What can I do?
if I type in cmd the followning I see a different path.
C:\Users\myuser>which java
/c/ProgramData/Oracle/Java/javapath/java
How can I change it which jdk if this is the option to fix the problem?
I want to set heap size under Linux OS in order to use it on java -jar command.
I have tried to add _JAVA_OPTIONS property under .bash_profile, but this property is ignored. I know I can run my jar with
java $_JAVA_OPTIONS -jar
command or create an alias like
alias java='java -Xms256m -Xmx512m'
I have found I can also export _JAVA_OPTIONS:
export _JAVA_OPTIONS="-Xms256m -Xmx512m"
But this property is not kept between sessions.
Any idea how can I set permanent heap size for java -jar command?
When I do the following command:
root#starwars:/# export JAVA_OPTS="-Xms756m -Xmx756m -Xss128m -Xmn512m"
In which file will the values "-Xms756m -Xmx756m -Xss128m -Xmn512m" be written?
The startup scripts of tomcat will run a setenv.sh file if it exists. Create it (in the tomcat bin/ ) directory and write your customization there, e.g. that file can just contain the line:
export JAVA_OPTS="-Xms756m -Xmx756m -Xss128m -Xmn512m"
when you do it from the command line, the params are not written anywhere. They exist only for your current bash session.
Put export JAVA_OPTS="..." in your ~/.bashrc or ~/.bash_profile files to persist them. If you are on OS X you will have to source the .bashrc file from .profile.
simply add it under startup.sh
like this
export JAVA_OPTS="-server -Xms2048M -Xmx2048M -XX:MaxPermSize=128M"
Hope it works.
The statement just assigns the environment variable JAVA_OPTS the given value. There is no file involved here.
Later JAVA_OPTS maybe passed to the command line of java executable
Those values will be used by catalina.sh, e.g.
"$_RUNJAVA" "$LOGGING_CONFIG" $JAVA_OPTS $CATALINA_OPTS \
-Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
-Dcatalina.base="$CATALINA_BASE" \
-Dcatalina.home="$CATALINA_HOME" \
-Djava.io.tmpdir="$CATALINA_TMPDIR" \
org.apache.catalina.startup.Bootstrap "$#" start \
>> "$CATALINA_OUT" 2>&1 &
So if you export that variable and then start Tomcat in the same console (e.g. using "catalina start" or "startup") then the JVM will be created with those parameters.
you can add them either to the /etc/init.d/tomcat script or /opt/tomcat/bin/startup.sh (or catalina.sh) for when tomcat is started
If you need this configuration only for a specific application you can set it directly in your IDE.
Open the "Edit Run/Debug Configuration" dialog
click the "Configuration Tab"
write the line in the "VM options" field
Run!
I'm trying to run Equinox and antRunner in "headless" mode with a custom eclipse.ini file. The "--launcher.ini" option should work according to:
http://wiki.eclipse.org/Equinox_Launcher .
However, when I run the following command line:
java.exe
-cp "C:\Program Files\eclipse\plugins\org.eclipse.equinox.launcher_1.1.1.R36x_v20101122_1400.jar" \
org.eclipse.core.launcher.Main \
--launcher.ini "C:\ini\my_eclipse.ini" \
-application org.eclipse.ant.core.antRunner \
-console \
-data "c:\my_workspace" \
-file "c:\my_buildfiles\build.xml" \
I get the following error message:
osgi> Unknown argument: --launcher.ini
Unknown target: C:\ini\my_eclipse.ini
Buildfile: .\build.xml
How can I load a custom eclipse.ini when starting Eclipse with Equinox from the command line?
The problem is that you are trying to launch using only the Java part of the launcher, while the wiki page describes the arguments for the native part of the launcher (eclipse.exe or any name you want).
The launcher.ini describes how to setup the Java process (memory size, vm location, arguments to vm, etc.). So, it makes sense that you pass refernece to the launcher.ini to the native launcher.
Is there any linux command I could use to find out JAVA_HOME directory? I've tried print out the environment variables ("env") but I can't find the directory.
On Linux you can run $(dirname $(dirname $(readlink -f $(which javac))))
On Mac you can run $(dirname $(readlink $(which javac)))/java_home
I'm not sure about windows but I imagine where javac would get you pretty close
Just another solution, this one's cross platform (uses java), and points you to the location of the jre.
java -XshowSettings:properties -version 2>&1 > /dev/null | grep 'java.home'
Outputs all of java's current settings, and finds the one called java.home.
For windows, you can go with findstr instead of grep.
java -XshowSettings:properties -version 2>&1 | findstr "java.home"
echo $JAVA_HOME will print the value if it's set. However, if you didn't set it manually in your startup scripts, it probably isn't set.
If you try which java and it doesn't find anything, Java may not be installed on your machine, or at least isn't in your path. Depending on which Linux distribution you have and whether or not you have root access, you can go to http://www.java.com to download the version you need. Then, you can set JAVA_HOME to point to this directory. Remember, that this is just a convention and shouldn't be used to determine if java is installed or not.
I know this is late, but this command searches the /usr/ directory to find java for you
sudo find /usr/ -name *jdk
Results to
/usr/lib/jvm/java-6-openjdk
/usr/lib/jvm/java-1.6.0-openjdk
FYI, if you are on a Mac, currently JAVA_HOME is located at
/System/Library/Frameworks/JavaVM.framework/Home
To show the value of an environment variable you use:
echo $VARIABLE
so in your case will be:
echo $JAVA_HOME
In case you don't have it setted, you can add in your .bashrc file:
export JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")
and it will dynamically change when you update your packages.
If $JAVA_HOME is defined in your environment...
$ echo $JAVA_HOME
$ # I am not lucky...
You can guess it from the classes that are loaded.
$ java -showversion -verbose 2>&1 | head -1
[Opened /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75.x86_64/jre/lib/rt.jar]
This method ensures you find the correct jdk/jre used in case there are multiple installations.
Or using strace:
$ strace -e open java -showversion 2>&1 | grep -m1 /jre/
open("/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75.x86_64/jre/bin/../lib/amd64/jli/tls/x86_64/libpthread.so.0", O_RDONLY) = -1 ENOENT (No such file or directory)
On the Terminal, type:
echo "$JAVA_HOME"
If you are not getting anything, then your environment variable JAVA_HOME has not been set. You can try using "locate java" to try and discover where your installation of Java is located.
Did you set your JAVA_HOME
Korn and bash shells:export JAVA_HOME=jdk-install-dir
Bourne shell:JAVA_HOME=jdk-install-dir;export JAVA_HOME
C shell:setenv JAVA_HOME jdk-install-dir
Here's an improvement, grabbing just the directory to stdout:
java -XshowSettings:properties -version 2>&1 \
| sed '/^[[:space:]]*java\.home/!d;s/^[[:space:]]*java\.home[[:space:]]*=[[:space:]]*//'
You can check from the command line by executing this command echo $JAVA_HOME. If Java is installed but the path is not set, you need to identify the path to your java installation. I prefer using sudo update-alternatives --config java which lists all installed versions with current active one marked and provides dialog to switch:
There are 3 programs which provide 'java'.
Selection Command
-----------------------------------------------
1 java-11-openjdk.x86_64 (/usr/lib/jvm/java-11-openjdk-11.0.14.0.9-2.fc35.x86_64/bin/java)
2 java-17-openjdk.x86_64 (/usr/lib/jvm/java-17-openjdk-17.0.2.0.8-1.fc35.x86_64/bin/java)
*+ 3 /usr/java/jdk-17.0.2/bin/java
Enter to keep the current selection[+], or type selection number:
from the above list, you can select the version of java you want to be the default. To set the JAVA_HOME to option 3 for instance you can do it this way export JAVA_HOME=/usr/java/jdk-17.0.2
http://www.gnu.org/software/sed/manual/html_node/Print-bash-environment.html#Print-bash-environment
If you really want to get some info about your BASH put that script in your .bashrc and watch it fly by. You can scroll around and look it over.