loading wrong jvm.dll - 64-bit

When I run an executable I created, it uses the jvm.dll from C:\Windows\System32. But I want it to use the jvm.dll in C:\Program Files\Java\jdk1.6.0_17\jre\bin\server.
C:\Program Files\Java\jdk1.6.0_17\jre\bin\server is in my PATH environment variable.
Does anyone know how to accomplish this?
Thanks.

To solve this problem use same bit software mean if you are using 32bit Flex sdk then use 32 bit jdk and if you are using 64 bit Flex sdk then use 64 bit jdk

Is your jdk1.6.0_17 path before the windows\system32 path in your PATH variable?
Another thing to try would be to set "JAVA_HOME" to the root directory of your non-system32 JRE install.

c:\windows\system32\java.exe is just a hook
and it loads default jvm from program files
do you know which one is it loading in your case?

Related

llvm-sys - Didn't find usable system wide LLVM. But llvm-config is installed

I have built llvm-13.0.1 from source using Visual Studio 17 2022 on Windows 11. When attempting to build llvm-sys (through external crate llvm-ir). It fails, saying:
error: No suitable version of LLVM was found system-wide or pointed to by LLVM_SYS_130_PREFIX.
I know llvm-config exists because I can use it from the command line, and it returns the correct version. I don't understand why this doesn't work. This might be a stupid question but I am really stuck.
I was also having this problem, trying to use llvm-sys on Windows. Here are some mistakes that I did that made it fail to compile just like yours.
Installation Prefix
Make sure that your LLVM installation path doesn't have any whitespace.
Mine was -DCMAKE_INSTALL_PREFIX=C:\Program Files (x86)\LLVM, which was their default install prefix. The whitespace in the installation path causes some errors when using it with llvm-sys. Later, I changed it to C:\LLVM and it worked.
Set Environment Variable
Set Environment Variable LLVM_SYS_<version>_PREFIX to the installed LLVM folder.
From CMD For LLVM-13.0.1
setx LLVM_SYS_130_PREFIX "<PATH TO LLVM WITHOUT WHITESPACE>" /M
Make sure that the variable is registered by using echo command
echo %LLVM_SYS_130_PREFIX%
It should output your registered path, not %LLVM_SYS_130_PREFIX%.
If it doesn’t output your path, restart the computer and try again and it should be working.
Now you should be good to go .....
Hope this helps :)

Cygwin Gcc error while loading shared libraries?

I have instaled Cygwin after running MinGW for a while now. But when I try to compile the console gives me:
/usr/lib/gcc/x86_64-pc-cygwin/4.9.2/cc1.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory
What does this mean?
I have the same problem and I found the solution.
According to the FAQ of Cygwin
Q: Why is C:\cygwin\usr\bin invisible from windows?
A: Because it does not really exist. In cygwin, /usr/bin is just a link to /bin.
So trying to add "C:\cygwin\usr\bin" to PATH will be in vain.
Add "C:\cygwin64\bin" to PATH instead. Hope this helps :)
You are missing a library, please run cygcheck /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/cc1.exe or ldd /usr/lib/gcc/x86_64-pc-cygwin/4.9.2/cc1.exe to see what is the missing library.
(I'd rather ask a question in the comments first, but I don't have enough reputation yet.)
Your cc1 is unable to load some DLLs it needs to start. Looking at the Cygwin source code, this can be either a library specified in LD_PRELOAD, or -- more probably -- a library the executable depends on. The ? in the error message seems to be the default return value of find_first_notloaded_dll (hookapi.cc), in case the function can't determine what library is missing.
To diagnose the issue, I suggest checking your PATH variable (or even clearing it of any non-Cygwin paths and trying the compilation again) and/or using Dependency Walker to find the missing DLLs (start it from a Cygwin shell, so it can see the same PATH). ldd (included with Cygwin) may also give some clues, but I wouldn't bet on it.
It's possible a clean re-install of Cygwin will be necessary to solve the issue.
Most likely, you are simply missing /usr/bin in the PATH variable.
Adding 'export PATH=/usr/bin:$PATH' to your .bashrc file will solve the issue.
Adding some background info. I had the same problem when building my own program and linking it against graphviz cgraph.dll. Turns out this is related to where windows searches for DLLs (see here: https://msdn.microsoft.com/en-us/library/7d83bc18.aspx) So adding the path of your missing library to PATH should fix the problem.
It is unfortunate that the message doesn't include the name of the library. Luckily cmd.exe DOES give you this name (so it's good for something after all;)
Are you including the path to your lib directory?
Looks like you are not
I'm not very familiar with Cygwin, I mainly use MinGW, but I think the error message speaks for itself
I also came this error on windows machine while executing .exe file generated by scilab2C i.e toolbox for Scilab
For Windows 32 bit Add the environment variable path as follow :
C:\cygwin\usr\i686-pc-cygwin\bin
Hope so this will solve your issue.
Just had this problem trying to compile a package with make and it wanted some cygguile dll file that was just installed along with make.
My solution was I had not only migrated my cygwin64 directory across drives because the sector sizes were mismatched for some reason even though the drivers were both under 2TB and should have been using 512 byte sector sizes.. So I had to install a new system and move files over there, might have had weird permissions on them.
Also had to patch cygwin1.dll end of Jan 2020 because of a recent input problem in ConEmu with Windows 10 1903 build, but just did it again with this working so that doesn't seem to be the issue.
Reinstalling cygwin by deleting that entire directory, taking ownership of it first.., seemed to work now...

Building opencv libraries doesn't generate "libopencv_java244.so"

I have been trying to get opencv to work in eclipse and I've been following this tutorial to try and get it to work in eclipse. I've gotten to the part where I create my .so libraries which is running make -j8. This works fine when I run it on a 32 bit linux system. I get all the necessary files I need but I get an exception in Eclipse when I try to run my program.
Exception in thread "main" java.lang.UnsatisfiedLinkError: /home/joris/opencv/build/lib/libopencv_java246.so: /home/user/opencv/build/lib/libopencv_java246.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)
After looking up what this means, I discovered that the library is 32 bit but my jvm is 64 bit. I can't change the jvm that I'm using, so I need to build my native libraries in 64 bit.
I tried building the opencv libraries on a 64 bit system now, but I am unable to find the libopencv_java246.so file that I got from building it on a 32 bit system.
user#BEL-8WF4XW1:~$ find /home/user/opencv/ -name *.so
/home/user/opencv/3rdparty/lib/mips/libnative_camera_r4.0.3.so
/home/user/opencv/3rdparty/lib/mips/libnative_camera_r4.2.0.so
/home/user/opencv/3rdparty/lib/mips/libnative_camera_r4.1.1.so
/home/user/opencv/3rdparty/lib/armeabi-v7a/libnative_camera_r2.3.3.so
/home/user/opencv/3rdparty/lib/armeabi-v7a/libnative_camera_r4.0.3.so
/home/user/opencv/3rdparty/lib/armeabi-v7a/libnative_camera_r3.0.1.so
/home/user/opencv/3rdparty/lib/armeabi-v7a/libnative_camera_r4.0.0.so
/home/user/opencv/3rdparty/lib/armeabi-v7a/libnative_camera_r4.2.0.so
/home/user/opencv/3rdparty/lib/armeabi-v7a/libnative_camera_r4.1.1.so
/home/user/opencv/3rdparty/lib/armeabi-v7a/libnative_camera_r2.2.0.so
/home/user/opencv/3rdparty/lib/armeabi/libnative_camera_r2.3.3.so
/home/user/opencv/3rdparty/lib/armeabi/libnative_camera_r4.0.3.so
/home/user/opencv/3rdparty/lib/armeabi/libnative_camera_r3.0.1.so
/home/user/opencv/3rdparty/lib/armeabi/libnative_camera_r4.0.0.so
/home/user/opencv/3rdparty/lib/armeabi/libnative_camera_r4.2.0.so
/home/user/opencv/3rdparty/lib/armeabi/libnative_camera_r4.1.1.so
/home/user/opencv/3rdparty/lib/armeabi/libnative_camera_r2.2.0.so
/home/user/opencv/3rdparty/lib/x86/libnative_camera_r2.3.3.so
/home/user/opencv/3rdparty/lib/x86/libnative_camera_r4.0.3.so
/home/user/opencv/3rdparty/lib/x86/libnative_camera_r3.0.1.so
/home/user/opencv/3rdparty/lib/x86/libnative_camera_r4.2.0.so
/home/user/opencv/3rdparty/lib/x86/libnative_camera_r4.1.1.so
user#BEL-8WF4XW1:~$
I don't understand why it does work on the 32 bit system but not on the 64 bit system.
Can anyone help me understand?
I had to do 2 things after installing open cv (I am on a 64 bit ubuntu system):
step 1:
it needed /usr/local/lib added tot the path to get it working.
(when missing a link, use sudo locate <filename> to find where it is)
this is not default, but can be added in /etc/environment: gksudo gedit /etc/environment
(you need a reboot after that)
step 2:
After this it might still not run. Use this to config links:
sudo ldconfig
I hope this will solve your issue (especially the last step might do the trick)

IntelliJ Idea under Linux, No such file or directory on main class

I'm running IntelliJ Idea under linux. I have created a project and a module inside it, and in that module I have a class (MyClass.class) and when I'm trying to run it from IDE, I get
ERROR: MyClass.class (No Such file or directory)
Can somebody explain me why IntelliJ Idea doesn't recognize the classes inside my module? I know it should be a problem regarding module settings but I can't figure it out. I'm using Ubuntu 11.10
OK I place here the paths and everything for all to see :)
type : echo $PATH
Result:
/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/java-7-openjdk-i386/bin:/usr/lib/jvm/java-7-openjdk-i386/bin:/usr/lib/jvm/java-7-openjdk-i386/bin
type: echo $JAVA_HOME
Result:
/usr/lib/jvm/java-7-openjdk-i386
type: ./idea.sh
Result:
NOTE: If you have both Sun JDK and OpenJDK installed
please validate either IDEA_JDK or JDK_HOME environment variable points to valid Sun JDK installation
Arkde, I have a possible explanation why Jaroslav's solution with JDK7 didn't work for you.
Maybe you had mixed Java versions in various alternatives items, possibly conflicting with the version that environment variables like JAVA_HOME and JDK_HOME point to?
Maybe something points to the /usr/lib/jvm/default-java symlink as the JDK home, and that symlink points to a different version of JDK than intended?
Did you try resetting alternatives for all Java tools to version 7? Like this:
update-java-alternatives --list
# ...see what JDK's are available, choose the one that corresponds to Java 7
# and set it to be the default in alternatives:
sudo update-java-alternatives --set java-1.7.0-openjdk-amd64
# or interactively:
sudo update-alternatives --config java
What do the following commands output on your system?
echo $JAVA_HOME
echo $JDK_HOME
ls -l /usr/lib/jvm/default-java
update-java-alternatives --list
update-alternatives --list java
I had exactly the same problem.
I've performed strace on the Idea process and in the log I saw it trying to open several .class files without the path to them specified - like open("SomeClass.class", O_RDONLY) = -1 ENOENT (No such file or directory) - no path to the project output directory and to appropriate package.
So I've apt-get installed JDK 7 along JDK 6:
apt-get install openjdk-7-doc openjdk-7-jdk openjdk-7-jre openjdk-7-jre-headless openjdk-7-jre-lib openjdk-7-source
In Ubuntu 11.10 Oneiric, OpenJDK 6 isn't removable if you want OpenJDK 7. JDK 7 is dependent on JDK 6...
So I've:
updated alternatives configuration as specified above,
changed the /usr/lib/jvm/default-java symlink to point to java-7-openjdk-amd64 ,
double checked all the environment variables (my JAVA_HOME and JDK_HOME both point to /usr/lib/jvm/default-java),
reconfigured my project's SDK appropriately (and for all the modules in the project),
and voila - problem solved!
Solved it. Remove all jdk/jre you have, install openjdk7.
Add this line to .bashrc
export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386/
export PATH=$PATH:$JAVA_HOME/bin
Run Idea. Profit. :)
I experienced the same problem. What I found is that the underlying system-wide Java version doesn't matter, so there is no need to set JAVA_HOME or update_alternatives. All I had to do was change some settings in IDEA:
Add a Java SDK, either OpenJDK 7, or Oracle JDK 6 or 7 (File -> Project structure -> SDKs)
Select it as Project SDK (File -> Project structure -> Project)
Check that Make checkbox is enabled, otherwise IDEA will not compile your project, also verify that class file is available in the output directory and you are running with the classpath of the correct module.
If the problem remains, send a sample project to support.
I've run into the same problem - I moved my projects (and Idea settings) from a laptop with Ubuntu 10.04 and sun-jdk-6 to a PC with Ubunty 11.10 and openjdk-6. Upon project rebuild I got MyClass.class (No Such file or directory) errors for ALL classes.
Thanks to Jaroslav, his (almost) solution did helped - I can't explain why, perhaps it would work with sun-jdk-6 too... So, I installed openjdk-7, without removing openjdk-6, and set 7th as a project's JDK in Idea. (I did not change anything in environment variables.) With jdk7 it compiled.
PS I should've written it as a comment to Jaroslav's post, not a separate answer, but I don't yet have enough reputation to do this...
Try to run IDEA using
sh -c "export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386 && ./idea.sh"
When it starts press Ctrl+Alt+Shift+S to open Project Settings dialog. In the left panel choose Project and verify that Project SDK is configured correctly (at least it is not red).

LD_PRELOAD_PATH for 32bits application on 64bits environment

I am on a 64bits linux running an application which is compiled for 32bits and have some libs in its directory.
So I do:
export LD_PRELOAD_PATH=./
./my_app
Still, I get errors of not finding the lib.
Is there other variable name for 32 bits libs search path?
Ps: I am sure I am not the first one to ask that, but I couldnt fint it.
I believe you want LD_LIBRARY_PATH, preload is a different beast.

Resources