I am trying to use Princeton Course specific Java Compiler (javac-algs4) on my windows machine and am seeing this error:
$ javac-algs4
warning: [path] bad path element "/usr/local/lift/lib/algs4.jar": no such file or directory
javac: no source files
This is related to Princeton Algorithms 1 Course. I followed the instructions on installing IntelliJ Idea from https://lift.cs.princeton.edu/java/windows/ and other steps to configure CLASSPATH.
javac and java work ok on HelloWorld programs, but I am expecting javac-algs4 to work for programs that use Course specific libraries.
It seems to me like a Unix Path may be hidden in the JAR file that I`m using in the CLASSPATH, and that may be breaking things for me. (Notice the /usr/local... directory in my error)
What steps could I take to troubleshoot and resolve the error?
Other Version Info:
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-8u191-b12-2ubuntu0.18.04.1-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)
Javac Version: javac 10.0.2
Related
I have trouble when trying to open my jar files with the following command:
java -jar software.jar
They load until a certain point and then nothing happens.
I deinstalled default-jdk and OpenJDK with synaptic and re-installed it with apt-get, but nothing changed. I had a similar problem one month ago and solved it (apparently only temporarly) by deleting the package gcj-5-jre-lib (5.4.0-6ubuntu1~16.04.4) (Java runtime library for use with gcj (jar files))
The following outputs will help:
java -version
openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-2ubuntu1.16.04.3-b11)
OpenJDK 64-Bit Server VM (build 25.131-b11, mixed mode)
javac -version
1.8.0_131
My variables $JAVA_HOME and $JRE_HOME were correctly added to my $PATH.
I'm on Ubuntu 16.04
EDIT
Here is an example of what I get when I try to start PhyDE.jar
java -jar PhyDE.jar
Welcome to PhyDE 0.9971!
Reading preferences.
Creating PhyDE-Application window
Checking for updates...
You are using the latest version of PhyDE
Done with checking for updates
When checking the core use with the command top I see that the process is active, but the user interface does not open as it usually does. I am located in the folder where the jar file is, and same happens with other jar files.
I built and ran a JAR on machineA as follows:
java -cp /foo/lib/dep1.jar:/foo/lib/dep2.jar:/foo/export/myjar.jar foo.bar.baz.MyMainClass ...
So myjar.jar is the JAR I built and the other two its dependencies. Ran without any issues.
I then wanted to do the same on machineB so I copied the 3 JAR files there, then tried:
/non/default/install/java -cp /bar/dep1.jar:/bar/dep2.jar:/bar/myjar.jar foo.bar.baz.MyMainClass ...
and got Error: Could not find or load main class. (NOTE: /non/default/install/java is a separate java install on machineB that I have to use instead of /usr/bin/java. Reason is "historical", i.e. I have no control over this)
On machineA, java -version gives
java version "1.7.0_91"
OpenJDK Runtime Environment (rhel-2.6.2.2.el6_7-x86_64 u91-b00)
OpenJDK 64-Bit Server VM (build 24.91-b01, mixed mode)
On machineB, /non/default/install/java -version gives
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
Both machines are running RedHat 6.
Why am I getting the error and how do I fix it?
Thx!
IMPORTANT UPDATE: I ran the commands below from command line on machineA. On machineB I originally ran them using a bash script. This means that I put them into run.bash and then ran bash run.bash from the command line. That's when I got the error. When I reran the same command from command line without using any scripts, it worked. So it seems that the problem had nothing to do with me copying the JAR form one machine to another but rather with the fact that I was invoking them form a script. And so the question really is now: how do I modify run.bash and/or the way I execute it to get rid of the error? (cuz I do need to use a script eventually)
So, I had always thought there was no difference between the java.exe located in the jdk\bin and that in the jdk\jre\bin folders. Apparently, that is not the case, certainly not with java8 anyway.
I was testing the maverick ssh library and found that it would not auto-negotiate an encryption cipher from the list offered by the sshd server when using the java.exe from jdk\bin. Changing the java.exe used to that from the jre supplied with jdk (in the jdk\jre\bin folder) let the test app work fine.
So... what could possibly explain the difference - why would one java.exe work and the other not, if they are both the same?
They appear the same on the surface:
C:\Program Files\Java\jdk1.8.0_20>dir bin\java.exe
08/22/2014 03:35 PM 190,856 java.exe
C:\Program Files\Java\jdk1.8.0_20>dir jre\bin\java.exe
08/22/2014 03:35 PM 190,856 java.exe
But must be different under the hood:
C:\Program Files\Java\jdk1.8.0_20>diff bin\java.exe jre\bin\java.exe
Files bin\java.exe and jre\bin\java.exe differ
EDIT:
I did review the question which is suggested as a duplicate, however it did not address my question.
The versions of the binaries appear the same:
C:\Program Files\Java\jdk1.8.0_20>bin\java -version
java version "1.8.0_20"
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)
C:\Program Files\Java\jdk1.8.0_20>jre\bin\java -version
java version "1.8.0_20"
Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)
I did not adjust the classpath or anything else on my commandline, other than the path to java.exe.
Compared the two using WinMerge... there are a few diffs nr the start and end (moreso) of the two files. All binary gobble-de-gook to me.
Re using that library and getting different results, that's almost certainly not anything to do with java.exe, but something to do with the classpath and jars used by the JDK install vs. the JRE install.
Re your different files, it's not just you: I dug up a Windows 8.1 machine with (an old copy of) Oracle's Java8 on it, and it's the same thing: Sizes, dates, and versions match, contents don't quite. This isn't true of my Linux box with Oracle's Java8 on it, where the jdk/bin/java and jdk/jre/bin/java files are identical (and not just symlinked). My guess is it relates to optimization defaults, but doesn't relate to your ssh library issue.
I'm trying to build the new Java bindings of Open MPI (v.openmpi-1.9a1r29661) on Macbook Pro running Mavericks (OSX 10.9). I have the JDK 7 installed:
^_^:examples demirelo $ java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
I configured the OMPI with that command:
./configure --enable-mpi-java --with-platform=optimized --with-jdk-dir=/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home --prefix=/Users/demirelo/libs/openmpi
which is followed by the usual suspect:
make all install
When I tried to run the HelloWorld example, I received the following runtime error:
^_^:examples demirelo $ ../bin/mpijavac Hello.java
^_^:examples demirelo $ ../bin/mpirun -np 1 java Hello
JAVA BINDINGS FAILED TO LOAD REQUIRED LIBRARIES
-------------------------------------------------------
Primary job terminated normally, but 1 process returned
a non-zero exit code.. Per user-direction, the job has been aborted.
Moreover, the ~/.bash_profile has the correct path to the /lib folder.
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/Users/demirelo/libs/openmpi/lib/
It's quite mysterious which libraries failed. Previously, I was able to build slightly older version (openmpi-1.9a1r28578) on Lion and still use it on Mavericks. This time I needed a freshly compiled OMPI but didn't work out. I'm wondering if anyone else had the same issue with Mavericks and was able to fix it.
This appears to be a bug in Open MPI that is comprised of at least two issues:
OMPI is hard-coded to try to dlopen libmpi.so, which is the wrong name on OS X (it should be libmpi.dylib).
Even after I fix that, I'm running into another Java error that I need to run by the Java programmers.
Apparently, we haven't tested the OMPI Java bindings on OS X in a long time. :-(
Such is the life of running against the SVN trunk. Sorry!
I'm having some trouble running an example from Bruce Eckel's Thinking in Java 3. Specifically, when I type
ant build
from the code root directory, as instructed on the website, I am able to compile all examples up to chapter 14 (directory c14), which is normal because I haven't installed a couple of libraries required to build the targets of chapter 14. However, when I cd to the directory corresponding to chapter 3 (c03) and invoke javac on the Assignment.java file, I get the following:
jason#debian-laptop:~/code/tij3/code/c03$ javac Assignment.java
Assignment.java:5: package com.bruceeckel.simpletest does not exist
...
where "..." refers to other compile-time errors which I get because of the compiler's inability to find the package com.bruceeckel.simpletest package.
My classpath, as you will note, includes the home code directory of TIJ3:
jason#debian-laptop:~/code/tij3/code/c03$ echo $CLASSPATH
.:..:/home/jason/code/tij3/code/
So I'm guessing that the directory tree nested in that directory should be well seen by the java compiler. After all, ant runs well. For the record, my Java version is 1.6.0_26:
jason#debian-laptop:~/code/tij3/code/c03$ java -version
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) Client VM (build 20.1-b02, mixed mode, sharing)
Any help with this would be immensely appreciated. Thank you,