Eclipse error log - java

I am running Windows 10 and I recently ran into a problem with opening Eclipse. Originally, I was unable to use the javac command on command prompt because of a message that said: "javac is not recognized as internal or external program". To fix this, I went into the environment variables and added the PATH variable, which was not there before, and made the address to the bin folder in my Java folder. This fixed that problem and allowed me to use javac and run my files, however, now I am unable to open Eclipse. Whenever I run Eclipse, The program starts to load then fails and refers me to the log. In the error log I get this:
So far, I deleted that PATH variable then retried Eclipse and an error message said it was unable to find a javaw.exe file. I found my java files and put the path to that file in my eclipse folder and tried eclipse again. This time, eclipse started to load but then failed and referred me back to the error log. It seems that eclipse is able to find the javaw.exe file but I'm not sure what else is wrong now.

My Eclipse and Java versions were not compatible. IF anyone else has this problem make sure of that first. After fixing this, I went to the PATH environment variable and I was able to add multiple paths, so I added both of these:
C:\Program Files\Java\jdk1.8.0_161\bin
and
C:\Program Files\eclipse\jre\bin
The first path is necessary to use javac from command prompt. The second address is necessary for eclipse to access the javaw.exe file.

Related

Terminal searching JDK in wrong PATH/Build failed, debugger for java

Error: could not open `D:\IntelliJ IDEA Community Edition 2018.2.5\JDK\lib\amd64\jvm.cfg'
I get this error every time I try to run a java program. Before it was working fine when i had JDK 8 but i upgraded to 14. I use VScode and I had deleted Intellij but the file path hasn't gone and the terminal is trying to find the intelliJ JDK for some reason. I am a beginner to terminal too. I have tried setting up the environment variable for the correct path but that isn't working.The path variable doesn't have the intelliJ reference in it and i have even set up the JDK_HOME but even that isn't working.
Edit: I have downloaded a extension called Terminal Manager but don't know how to configure it.Will it work?(Edit: It doesn't, it's not what i thought it is used for)
Yet another edit: Is there a way to specify the path for JDK every time I use java commands in the terminal and does it have auto-completion(using tab). Should i just reset my machine because i can't seem to figure out this problem.
Where java in the command prompt gives C:\Program Files (x86)\Common Files\Oracle\Java\javapath\java.exe, not the path for the JDK 14. I updated the environment var path to point to the latest JDK but now i get INFO: Could not find files for the given pattern(s). in the command prompt.
In VScode, on opening the Configure JavaRuntime,That is showing me 4 paths, 2 are the correct ones(one is labelled current), one empty and the invalid path. I can't seem to find any way to remove the incorrect one. Though it has the correct path, it still searches for the deleted file.
Update: The program now compiles but every time it shows:
Build Failed
Debugger for Java
Proceed Fix Cancel
I click fix and clear the workspace cache but it doesn't work. It runs without the debugger but it would be better if it worked.
Install the "choose runtime" plugin this will allow you to select the runtime your self.
Start the IDE, use (Ctrl+Shift+A or Cmd+Shift+A on Mac), type "Choose Runtime", press Enter.
You will be able to download the latest version from here and it will be automatically configured to the config path

Intelij idea error "Could not find or load main class" when trying to add "-Djava.library.path" as vm option

I have a Windows 64 bit pc.
I'm trying to connect a Java program to my Arduino. This site says I have to use this as the command line argument: "java -Djava.library.path='RXTXcomm.jar location' 'Program name'". I am using intelij-idea as ide, so I typed "-Djava.library.path=D:\Install\Java Projects\Arduino\mfz-rxtx-2.2-20081207-win-x64" in Run configuration / VM options, "D:\Install\Java Projects\Arduino\mfz-rxtx-2.2-20081207-win-x64" being the location of RXTXcomm.jar. I also added that location to the PATH system variable, because that directory alse has the rxtxSerial.dll and rxtxParallel.dll files.
Run configuration picture: http://i.imgur.com/Lvsw5u0.png
I get the error "Error: Could not find or load main class Projects\Arduino\mfz-rxtx-2.2-20081207-win-x64". Does anyone knows how to fix this?
You have a space in your directory name ("Java Projects"). Try enclosing the value of the system property in quotation marks:
-Djava.library.path="D:\Install\Java Projects\Arduino\mfz-rxtx-2.2-20081207-win-x64"
If that doesn't work, put the library in a directory with no spaces in the path.

Rake command not found after messing with PATH -- Also, no rails commands work either

Changing my system PATH variable seems to have just screwed up everything.
So, I was trying to run rake device:android:production to make an APK of the app I've been working on with RhoMobile / Rhodes. I got an error telling me that something with my java bin folder was off, so I went and examined my system PATH variable and changed it to my JDK bin folder. It was previously some path that RhoMobile added when I installed it.
So, now I'm getting Rake Command Not Found instead of the java bin folder not found error I was getting before.
I can't run rails server or any rails or gem commands either, and for some reason even commands like ls aren't working for me any more.
How the heck can I get this working again and what did I do?
Changing my PATH allowed me to finally use javac and java commands, but screwed up literally everything else. I am using Windows 7.
That doesn't seem like a Ruby question, but if you're on Windows I assume you're running either the Windows Installer version(rubyinstaller.org) or JRuby?
The PATH variable should contain
c:\ruby200-x64\bin
or
c:\jruby-1.7.3\bin
or the respective path to your local ruby.

Cannot determine current directory

I am trying to run a .jar file that was created successfully in Netbeans and I am receiving the following error:
Error occurred during initialization of VM java.lang.Error:
Properties init: Could not determine current working directory. at
java.lang.System.initProperties(Native Method) at
java.lang.System.initializeSystemClass(System.java:1070)
The command that I type to run the .jar is
java -jar "/path to the dist forlder/EOPPrototype.jar"
My classpath is as follows:
CLASSPATH=/opt/netbeans-7.1.2/ide/modules/ext/mysql-connector-java-5.1.13- bin.jar:/h/USERS/local/pagola/NetBeansProjects/mylib/dist/mylib.jar:/h/USERS/local/pagola/NetBeansProjects/EOPPrototype/build/classes:.
What am i missing?
I saw the same error when I was trying to call java -version inside a directory, which I already had deleted from another terminal session. Of course in that case java could not determine the current working directory, simply because it didn't exist.
Solution: cd to another directory and run that command again, that works for me.
See explanation here: https://bugs.openjdk.java.net/browse/JDK-8186434
In Fedora 21, I tried calling the "java -version" after an uninstall and it gave the above error. Close all the terminals and open them again and try.
Should work.
I was getting the same error message, but I'm not sure if it was for the same reason as I don't use Netbeans. I use my terminal and compile with ant.
I cd'd to a directory to run a javafile.class file. The file I want to run is part of a bigger package. The directory structure of the package looked something like this: a/b/c/javafile.class. The a, b, and c directories are all part of a larger package.
To run my javafile.class, I cd'd into a and ran the file from there: java b/c/javafile. After I made some changes and recompiled with my ant script, the directory I was in had been deleted and remade by ant. So, when I ran javafile.class again, I got the error you're getting.
I fixed my problem by cding out of the directories that are deleted and remade by ant and then running my javafile.class again.
maybe you did not config java environment on your workstation correctly
the following configurations were what I did in my mac
vi ~/.bash_profile
and add those in it
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home
PATH=$JAVA_HOME/bin:$PATH:.
CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:.
export JAVA_HOME
export PATH
export CLASSPATH
replace
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home
with your jdk version
and then run
source ~/.bash_profile
to use these config immediately
then you can check by
java -version
I got the same error -
Error occurred during initialization of VM
java.lang.Error: Properties init: Could not determine current working directory.
by just doing 'java -version' (you would think it wouldn't need to bring up a
virtual machine just to answer a simple question like 'what version are you?')
A higher up element (that between the slashes) of the directory path of the pwd
had spaces in it. When I made the current working directory one which from /
downward didn't have any spaces the 'java -version' command got a proper response.
I'm concluding they didn't account for directories with spaces when they
programmed it. But that was version 1.7. I've now loaded version 8 so hopefully
it has been corrected.
I got this error on Mac OS X and this is a genuine error since the directory has vanished. The directory I was when I am executing the commands is <PROJECT DIR>\target.
The problem was I opened two terminals in the other terminal I ran mvn clean install and the target directory from PROJECT DIR got deleted and recreated.
My old terminal from where I was executing Java commands is not in a valid directory.
The file descriptor is invalid since the directory got deleted by Maven.
When I moved back to the parent directory and the changed back to the target directory, the java command started working correctly as expected.
Under CentOS, rhel, SL or SLC? Not an issue under debian/ubuntu.
I found you need to logout of the shell you are using and log back in. The environment is not set up initially correctly for the current shell. After login I see that: java -version will work.
Also ensure that /etc/alternatives/java actually points to something reasonable like:
ls -lisa /etc/alternatives/java
72645 0 lrwxrwxrwx. 1 root root 46 May 27 11:29 /etc/alternatives/java -> /usr/lib/jvm/jre-1.7.0-openjdk.x86_64/bin/java
Just now, i got the same error. because i use java to setreuid/setregid to apache:apache, when i change back to root:root, i changed gid before uid, the real result is root:apache. everything going wrong, such as the error say "java.lang.Error: Properties init: Could not determine current working directory. "
you can check it.
I was having this error in my mac, when I start tomcat from my eclipse. After setting JAVA_HOME and restarting the eclipse, the error is fixed.
You have to install default-jdk first !
sudo apt install default-jdk
only version 11 does not set all the environment correctly
in place of : sudo apt install openjdk-11-jdk
You may get this error if you issue "java -version" or other java command from a read-only directory. For example using openjdk 8 on centos (as non-root user):
cd /usr/bin
java -version
Error occurred during initialization of VM
java.lang.Error: Properties init: Could not determine current working directory.

'javac' cannot be found problem

I have a Java application hosted on a remote tomcat instance that executes a bat file which contains the following line
javac filename.java
I receive the following error :-
'javac' is not recognized as an
internal or external command, operable
program or batch file.
I have set the path in the environmental variables. I tried running the same bat file on the machine, it works(which means there is nothing wrong with the path). But running it through the application gives the error. What might be the problem?
Setting the correct path in your environment does not fix the path in the environment of the running tomcat process. If you changed the path in the system settings, a tomcat restart (or system reboot) probably solves your problem.
Once you add %JAVA_HOME%\bin to the PATH var on the remote machine (assuming you have %JAVA_HOME% set there), you will need to run up a new cmd window for the new PATH to be available.
You should set the classpath for the user who is executing tomcat, not only for your login user.
If you have the JRE installed, and not the JDK, you'd be able to run Tomcat but there wouldn't be a javac.exe. Go to JAVA_HOME/bin and see if there's a javac.exe. If not, you have the JRE installed, and you'll have to go get the JDK.
Just curious - why is your Tomcat app calling javac.exe? Are you creating classes on the fly? If yes, why would you not be generating byte code using ASM instead?

Categories

Resources