I am trying to run DynamoDB locally, with the instructions here:
http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html
I've downloaded the zip file, and unzipped everything into a folder.
I'm on Windows 10.
In Powershell, in that directory when I run:
java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb
I get:
Error: Could not find or load main class .library.path=..DynamoDBLocal_lib
I've read this which is very similar - closest I could find but it didn't help:
java.lang.UnsatisfiedLinkError: no sqljdbc_auth in java.library.path
I don't think the issue is that it cannot find the class, it is that it doesn't know what library.path means.
I have java installed:
C:\Dynamo> java -version
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b15)
Java HotSpot(TM) Client VM (build 25.91-b15, mixed mode)
In my PATH I have C:\ProgramData\Oracle\Java\javapath which I think is correct.
Do I need the JDK? not just JRE? Am I doing something else wrong?
I think that the path in the example may not be correct for windows, but I don't think that is the problem, I have tried dozens of different paths, but they all say the same thing.
We found that PowerShell misinterprets the -Djava.library.path parameter.
Enclosing either the parameter name or the entire name & value fixed the issue in our case.
java -D"java.library.path"=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb
or
java "-Djava.library.path=./DynamoDBLocal_lib" -jar DynamoDBLocal.jar -sharedDb
The answers to this question also helped
How to pass Properties to jar from Powershell?
Tried one last time before posting the question, this time with just a normal command prompt rather than powershell and it works. The path in the example worked fine.
Related
Trying to get OpenJDK 17 installed for Pufferpanel. User pi can do java -version fine however Pufferpanel gets bash: java: command not found
My /etc/profile and /etc/profile.d/java.sh have these lines:
#JAVA
export JAVA_HOME="/usr/lib/jvm/jdk-17.0.1+12"
export PATH=$JAVA_HOME/bin:$PATH
In addition JAVA_HOME="/usr/lib/jvm/jdk-17.0.1+12" is set in /etc/environment
Full permissions have been given for java.sh and the JAVA_HOME folder with chmod 777. The user pufferpanel now can run the script however the error stays the same: bash: java: command not found.
Trying some things out and found this:
pufferpanel#raspberrypi:/home/pi$ whereis java
java: /usr/share/java
Meanwhile pi gives this output:
pi#raspberrypi:~ $ whereis java
java: /usr/share/java /usr/lib/jvm/jdk-17.0.1+12/bin/java
Good news is that Java does run as the user pufferpanel:
pufferpanel#raspberrypi:/usr/lib/jvm/jdk-17.0.1+12/bin$ ./java -version
openjdk version "17.0.1" 2021-10-19
OpenJDK Runtime Environment Temurin-17.0.1+12 (build 17.0.1+12)
OpenJDK Server VM Temurin-17.0.1+12 (build 17.0.1+12, mixed mode, sharing)
My guess is that PATH is getting overwritten somewhere, just don't know where.
If there are easier ways to install Java that is higher than version 16 just to get Minecraft to work, please tell me!
What you are doing is fine, but you should probably create a custom.sh shell script in /etc/profile.d/
As for environment variables, like JAVA_HOME, they should go in /etc/environment
Setting the PATH in ~/.bashrc worked out, copied java.sh and pasted it in. Couldn't find ~/.bashrc at first, but this helped to figure that out.
As Pufferpanel is a different matter, I'm marking this the answer to my question which was getting Java to work as an user.
I downloaded and installed UMD's FindBugs 3.0 in /usr/local/share/findbugs-3.0:
$ ls /usr/local/share/findbugs-3.0/
FindBugs.jar
I have a little script to run it:
$ cat ./findbugs
FINDBUGS_HOME=/usr/local/share/findbugs-3.0
java -jar $FINDBUGS_HOME/FindBugs.jar $*
Running the script results in:
$ ./findbugs
Error: Could not find or load main class edu.umd.cs.findbugs.bluej.FindBugsExtension
Dumping the JAR:
$ jar tf /usr/local/share/findbugs-3.0/FindBugs.jar | grep "edu/umd/cs/findbugs/bluej/F"
edu/umd/cs/findbugs/bluej/FindBugsCompileListener.class
edu/umd/cs/findbugs/bluej/FindBugsExtension.class
edu/umd/cs/findbugs/bluej/FindBugsPreferences.class
It seems the class is available. I'm not sure how to proceed because java -jar ... usually works. And the FindBug docs tell me to run java -jar $FINDBUGS_HOME/findbugs.jar
What does “Could not find or load main class” mean? is good, but I think I am doing everything the question tells me to check for.
I don't have sources and don't build the JAR (I'm using a supplied JAR), so this does not seem to apply: Could not find or load main class with a Jar File. I did try running with java -cp $FINDBUGS_HOME/FindBugs.jar edu.umd.cs.findbugs.bluej.FindBugsExtension as suggested, but it results in the same error. And I did verify the dash (-) was correct per Max's answer.
I've also tried some knob turning, like removing the export CLASSPATH, removing the quotes around $FINDBUGS_HOME/FindBugs.jar and removing the $* from the command, but they have not helped.
What seems to be the trouble here? How do I make java find/load the class when running findbugs?
Possibly related: OS X 10.8.5, fully patched.
$ java -version
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)
How to resolve this? I can compile it but I can't run it. I have different versions of javac and java. I'm trying to run my .java file on terminal. But it works in eclipse. I know that version affects this. How to upgrade javac? Will it affect my eclipse if I do so? Thanks. ;)
[clemjon#localhost ~]$ javac -version
javac 1.6.0_20
[clemjon#localhost ~]$ java -version
java version "1.6.0_21"
Java(TM) SE Runtime Environment (build 1.6.0_21-b06)
Java HotSpot(TM) Server VM (build 17.0-b16, mixed mode)
This is not an issue to do with different versions of javac and java. The problem here is that you are attempting to run a class file whose fully-qualified name (com.pl.casestudy.First) doesn't match the class name you passed to java (First). You would get the same error if you had the same versions of javac and java.
If you have a class whose name is com.pl.casestudy.First, Java will look for it in a file with name com/pl/casestudy/First.class (Windows users feel free to reverse the direction of the slashes.) So you will need to run your First class from the directory that contains the com subdirectory. I can see from the shell prompt in your stacktrace that you have a directory named casestudy, I'll assume that the com and pl parent directories also exist. Eclipse has probably created them for you.
Try cding out to the directory that contains com, compiling using
javac com/pl/casestudy/First.java
and running using
java com.pl.casestudy.First
Check which JRE eclipse is using:
Window->Preferences->Java->JREs
Right click the selected one and Edit.
The JRE home path should be there. Add that path to your path environment variable (instead of the one that is already there) and that should do the trick for you.
You can also set which JDK version you want Eclipse to compile to:
Window->Preferences->Java->Compiler
My best advice would be to keep track of all the installed JDK's and JRE's.
Choose the ones you want to use by default and add those to your JAVA_HOME and Path environment variables; Then setup your Eclipse to the same values using the steps above.
Then if for a particular project you need to use a specific JRE, right click on that project and then go to BuildPath->Libraries->JRE
Library->Edit and pick you JRE.
Disclaimer: I'm not on my dev machine right now so the names may be approximate. :)
Hi everybody.
The problem: elcipse-3.5.0 (Galileo) spits with an error when I try to launch it by clicking its launcher. The curse sound like this:
A Java Runtime Environment (JRE) or
Java Development Kit (JDK) must be
available in order to run Eclipse. No
Java virtual machine was found after
searching the following locations:
/home/emanemos/bin/eclipses/eclipse-3.5.0/jre/bin/java
java in your current PATH
However, everything goes smoothly when eclipse is started from console.
Before installing eclipse I've installed jdk1.6.0_16. I also created the $JAVA_HOME variable and changed my $PATH:
$ echo $JAVA_HOME
/usr/lib/java/jdk1.6.0_16
$ echo $PATH
/home/emanemos/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/java/jdk1.6.0_16/jre/bin
So that, my terminal got to know what java is:
$ java -version java version
"1.6.0_16" Java(TM) SE Runtime
Environment (build 1.6.0_16-b01)
Java HotSpot(TM) Client VM (build
14.2-b01, mixed mode, sharing)
Then a folder eclipse was extracted from .tar.gz package under the directory ~/bin/eclipses. I changed the folder's name eclipse to eclipse-3.5.0 and changed $PATH again:
$ echo $PATH
/home/emanemos/bin/eclipses/eclipse-3.5.0:/home/emanemos/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/java/jdk1.6.0_16/jre/bin
From this moment I was blessed to launch eclipse from console by the command eclipse.
However, I feel desperate about using the eclipse's application launcher.
Thanks in advance. I would be grateful for any help.
The message says "No Java virtual machine was found after searching the following locations: /Applications/eclipse/Eclipse.app/Contents/MacOS/jre/bin/"
I have solved it creating the folder /Applications/eclipse/Eclipse.app/Contents/MacOS/jre/bin and linking to the command at /usr/bin/java:
ln -s /usr/bin/java /Applications/eclipse/Eclipse.app/Contents/MacOS/jre/bin/java
Add this to eclipse.ini:-
-vm
$Java_home/jdk1.5.0_14/bin/javaw.exe
I could be off, but it looks to me that you don't have JAVA in your path. If you notice, you had to add it via the echo command. However, that only stays for that session of the terminal. You don't permanently affect the system. (I believe that's why you can launch from the terminal, but not via the launcher.)
Do you have the Java JRE actually installed on your system? If not, I would recommend doing that as that should do all the setup that you would need, then try running Eclipse again.
Edit: I noticed you said that you did install the 1.6 JDK. This should have fixed your problem. If Java is not in your path when you first open up your terminal, then that (I believe) is your real problem and you may need to do a reinstall or troubleshoot there.
(Making a big assumption that you're on Linux using X)
If you've installed the Java JRE without logging out and back in to the X session, the environment the session is in won't contain the $JAVA_HOME variable. It may just be a case of logging out and back in in order to get a new X session.
If you want to keep the same session running, you could try it out by pressing Ctrl+Alt+F9 to start another GUI session.
Fazil Baghirzade i solve the this problem
A Java Runtime Environment (JRE) or Java Development Kit (JDK) must be available in order to run Eclipse. No Java virtual machine was found after searching the following locations:
c:\Program Files\Eclipse\jre\bin\javaw.exe 'javaw.exe' in your current path
go to the "C:\Program Files\Java\jdk1.6.0_39" in this folder have "jre" folder copy it and paste the eclipse folder
thats all!!!
I'm trying to run SQuirreL SQL.
I've downloaded it and installed it, but when I try to run it I get this error message:
Java Virtual Machine Launcher.
Could not find the main class.
Program will exit.
I get the gist of this, but I have not idea how to fix it. Any help?
more info:
I'm on Windows XP pro.
I have java 1.6 installed, and other apps are running OK.
The install ran OK.
I believe I've followed the installation instructions correctly.
To run it, I'm invoking the squirrel-sql.bat file.
Update
This question: "Could not find the main class: XX. Program will exit." gives some background on this error from the point of view of a java developer.
Is Java installed on your computer? Is the path to its bin directory set properly (in other words if you type 'java' from the command line do you get back a list of instructions or do you get something like "java is not recognized as a .....")?
You could try try running squirrel-sql.jar from the command line (from the squirrel sql directory), using:
java -jar squirrel-sql.jar
The classpath is the path that the system will follow when trying to find the classes that you're trying to run. In the batch file you're trying to execute it probably has a variable like CLASSPATH=blah;blah;etc or a java command that looks similar to
java -classpath "c:\directory\lib\squirrel-sql.jar" com.some.squirrel.package.file
If you can find or add that classpath setting, make sure that it includes a path to the squirrel-sql.jar and any other jar files that it may depend on separated by semicolons (or the root /lib directory that may be included with the installation).
Basically you just need to tell java where to find the class files that you're trying to execute. Wikipedia has a more indepth discussion about classpath and can offer you more insight. http://en.wikipedia.org/wiki/Classpath_(Java)
JAVA_HOME variable must be set, to point to the prog files/java/version???/bin
open squirrel-sql.bat file with some text editor and see if the JAVA_HOME variable there is the same as the one in your enviroment variable
change it if it doesn't match....and than run bat file again
Have you followed these instructions:
http://www.squirrelsql.org/#installation
If so, are you running the batch file or the shell script to run it?
Tweaking MB's answer for windows, will get rid of the console window:
start javaw -jar squirrel-sql.jar
The .bat file does not seem to work.
Just double-click on:
squirrel-sql.jar
or type:
java -jar squirrel-sql.jar
in the command-line.
You can place .; in classpath in environmental variables to overcome this problem.
I tried to start SQUirrel 3.1 but I received a message stating "Could not find the main class Files\Rational\ClearQuest\cqjni.jar" I noticed that C:\Program Files\Rational\ClearQuest\cqjni.jar is in my existing classpath as defined by the Windows environment variable, CLASSPATH.
SQUirrel doesn't need my existing classpath, so I updated the SQUirrel bat file, squirrel-sql.bat.
REM SET SQUIRREL_CP=%TMP_CP%;%CLASSPATH%
SET SQUIRREL_CP=%TMP_CP%
It no longer appends my existing classpath to its classpath and runs fine.
I had this problem when I "upgraded" to Windows 7, which is 64-bit. My go to Java JRE is a 64-bit JVM. I had a 32-bit JRE on my machine for my browser, so I set up a system variable:
JRE32=C:\Program Files\Java\jre7
When I run:
"%JRE32\bin\java" -version
I get:
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) Client VM (build 24.51-b03, mixed mode, sharing)
Which is a 32-bit JVM. It would say "Java HotSpot(TM) 64-Bit" otherwise.
I edited the "squirrel-sql.bat" file, REMarking out line 4 and adding line 5 as follows:
(4) rem set "IZPACK_JAVA=%JAVA_HOME%"
(5) set IZPACK_JAVA=%JRE32%
And now everything works, fine and dandy.
I had the same issue with a different application (BI Publisher) because I installed a 32 bit version of this application on a 64 bit version of Windows.
Java Virtual Machine Launcher - could not find the main class
The solution for my case was to tell BI Publisher where to find the x86 version of JRE: