Java database path not found - java

I'm attempting to change the file path of eclipse java neon to access a database I need for my programming class and I cant figure out how to do it for windows 10 (the book only instructs us on on how to do it in window 8 and 7).
I'll give you the short version and just say that the book tells me to either edit the current classpath to look something like .;C:\Program Files\Java\jdk1.7.0_51\db\lib\derby.jar or to make a new one that looks like that.
The problem is when I changed it to look like that it kept giving me a path error and I just need to fixed that error. My version of Java is jre1.8.0_111 and the database I am supposed to be making is called CoffeeDB (though I don't think you need that info).
The end game of this is to be able to connect to databases so I can do my homework of creating and changing them.
If you need more information to help I am more than willing to give it, I'm just not sure as to what more you would need.

Specifying the classpath for your pc
See these IBM article and Oracle tutorial about classpath management.
Specifying the classpath for eclipse
Eclipse usually sync the class path with the system. But just to be sure -
Step 1:
Right click on your current project -> Build Path -> configure built path
Step 2:
On left side tab; select Java Built Path
Step 3:
On right side tab; select Add Library
Step 4:
Select JRE System Library.
Select Environment, Installed JRE(jdk 1.8) -> Finish -> Apply -> OK.
Related Question (problem related to installation of JDK, JRE)
Maybe you find something beneficial here
Eclipse - no Java (JRE) / (JDK) ... no virtual machine

Related

How to save Java Project from IntelliJ IDEA to Git repo so it will build on another PC after cloning?

I'm building a simple calculator app from a tutorial/class on Pluralsight (Java Fundamentals class), which starts with a Main.java file, and adds a class file later, MathEquation.java.
I created a Git repo to track my progress, and uploaded to Github: JavaFundamentalsClass. I used GitIgnore.IO to find a Java IntelliJ .gitignore file, and everything seemed to be working fine on the original PC I was using.
However, after switching over to a different PC, with a fresh install of IDEA, I cloned down the repo from Github, and found that the project would not build and/or run. I get this error:
"C:\Program Files\RedHat\java-1.8.0-openjdk-1.8.0.191-1\bin\java.exe" -Dfile.encoding=windows-1252 -jar ""
Error: Unable to access jarfile
Process finished with exit code 1
I suspect that there is something in the .gitigore file that is keeping some of the project, dependency, or build information from being saved in the repo that keeps IDEA from having all the info it needs to build and run the Main.java correctly.
Can anyone help? You should be able to download the project from the repo linked above in it's currently broken state, including the .gitignore file.
Additional Info
I wiped my repo clean and recloned and I forgot, originally it doesn't even give me the run button (it is grayed out). I had to do a procedure with "Add Configuration" from a search I did for that to show up to get the error above.
Also, I did install java from the OpenJDK, rather than oracle. I figured with Oracle cutting off commercial development maybe start the switch now as I'm learning, but maybe that's the issue (normal Java on my other PC).
It's working, but...
First thing - Intellij needs to know where Java is. It appears that if the SDK/JDK is not installed prior to Intellij, you will need to tell it where Java is after installing. Or if you use OpenJDK instead of Oracle Java SDK. You can do that at View/Open Library Settings, under Platform Settings / SDKs (select the JDK home path).
Then, after setting up Java, I am able to get everything working in Intellij IDEA if I find the Main.java file, right-click, and choose "Run main.main()". This runs the program okay, and also creates a Main configuration in the Run/Debug configuration area, and finally the "Run" button becomes available.
So I can get it working, but if I wipe all the files and clone it fresh from the remote repo, I have to go through running the Main.java file directly again to recreate the configuration.
So, this still doesn't answer my original question. Why doesn't this configuration get saved in the repo? What file is this information saved in? Is there something in the .gitignore file that is keeping this information from being saved to the repo?
Look like you have a different java version on your second machine.
First of all, check your java version
Update the configuration of your project, right now it pointing to java 1.8
https://github.com/LightCC/JavaFundamentalsClass/blob/master/.idea/misc.xml
I think it might be because of java not installed on the other PC you were trying. If it is installed just check whether the path mentioned has java executable file.
The first part is ensuring Java is setup, and that Intellij IDEA knows where Java is, per the other answers, comments, and addendums to the question.
The second part is setting up the run/debug configuration, per the "It's working but.." section of the question. This can be created automatically by right-clicking the file that has the main class to be run (usually Main()...), and selecting the "Run Main.main()" option (replacing Main and main() with the file and function which needs to be run)
The final piece is that to get the run/debug configurations to save to the repo, you either need to:
Share the workspace.xml file (i.e. make sure this is not in the .gitignore file). However, there is a lot of user-specific stuff in that file, so it should normally be excluded from the repo.
Or, edit the configuration and checkmark the "Share" box in the upper right-hand corner (just right of the "Name" field). This will put the configuration into a separate folder inside the .idea folder, which should not be excluded from the repo by .gitignore.

The specified task executable location "C:\Program Files (x86)\Java\jdk1.7.0_71\\bin\javac.exe" is invalid

Ok im wondering where does xamarin get this path from?
Severity Code Description Project File Line Source Suppression State
Error The specified task executable location "C:\Program Files (x86)\Java\jdk1.7.0_71\\bin\javac.exe" is invalid.
So I can go and change it to the new jdk1.8. I have the new JDK set up I just need to know where to change the path at.
I had the same problem and solution is.
Remove all jdk and install jdk 1.8
Change reference java location in Visual Studio Tool > Options > Xamarin
Clean and Rebuild Project
I've just solved this exact problem for me.
I don't know why you wouldn't have a JDK_HOME variable. Completely remove the JDK and install it again maybe?
The Environment Variables for java were set to my previously installed path. I guess Oracle screwed up here.
As I had the same error, here's what I did:
I went to C:\Program Files\Java\ and checked what the jdk folder is called. For me it's jdk1.8.0_102.
For users who don't know where to find System Variables:
Go to System Properties and on the left hand side, click Advanced System Settings. Switch to the Advanced tab, click Environment Variables. Under System Variables there should be two variables in the list called JAVA_HOME and JDK_HOME.
I edited those values and change the path to what I found in the java folder. In my case this would be C:\Program Files\Java\jdk1.8.0_102.
No need to close VS, just build your app and it should get passed the annoying error.
Hope this helps :)
I had exactly the same problem. I got it to go away (which is not the same thing as fixing it).
Un-install every bit of JAVA you have. Delete both JAVA folders (Program Files and Program Files (x86)).
Install the latest version of the Java (x32) SDK.
Clean and Rebuild your project(s).
Since my Solution is multi-platform, I changed the Startup Project to the .iOS one, built it, ran it in an emulator, and set the Startup Project back to the .Droid project.
Somewhere in all this, the problem went away.
And remember kids! If it can go away all by itself, it can come back again all by itself!
I had this issue as well, I downloaded 32 bit Java but VS was still looking for the 64 bit one.
To solve it all I had to do was change the JAVA_HOME and the variable in my Path, clean my project and rebuild it.
Just set JAVA_HOME and JDK_HOME ambient variables, clean your solution and build again. For me worked fine.
Don't forget to clean your solution.

Eclipse with EclipseLink: How?

I am using ubuntu. I want to build a JPA project with eclipse. According to that tutorial I need to have EclipseLink.
Therefore I went to EclipseLink download page, got .zip achive and tried to follow instuctions - set the paths.
JAVA_HOME - Set JAVA_HOME to where you installed your Java SDK home >directory
UNIX example: JAVA_HOME = ...:/usr/java/jdk
PATH - Set PATH to include JDK/bin directory.
UNIX example: PATH = ...:/usr/java/jdk/bin
okay. My SDK Eclipse, and it is located in /usr/lib/eclipse. Though I also have /usr/lib/java/swt-gtk-3.8.jar. What should I use here?
Next. Then I take unziped eclipselink folder. It is written, that I should make path to it:
UNIX example: ECLIPSELINK_HOME = ...:/usr/el/INSTALL_DIR/eclipselink
So, for example, I place it like this:
ECLIPSELINK_HOME=/home/laura/lib/eclipselink
Please, help me. Are my steps correct? What I need to do after set all paths?
So, here you are. The answer qas quite simple: I should have had installed the newest version of Eclipse, where I would have an option to make a JPA project. Then goes an option to choose a platform, EclipseLink, for example.

Is there a tool to update a project to a new version of Java?

I'm looking for something like an Eclipse plugin or wizard to step through a large code base (in Java 6) and point out the parts that need to be changed to update to Java 7, perhaps giving suggestions or tips.
I found instructions for doing it manually here, but I was wondering if anyone knew of a tool to make the process more automated.
You can accomplish your goal by manipulating your build environment in Eclipse.
Just switch your JRE System Library being used for the project to Java 7 and see what breaks (Project > Java Build Path > Select and Edit JRE System Library) . Eclipse will give you fix suggestions if they are available for each issue. You can see a list of errors in the "Problems" view (Window > Show View > Problems).

Changing Java Version From Within Eclipse

I wrote a project in eclipse with an older version of java.
Now on a different computer but running the same codes I'm getting a whole lot of red.
This is due to Version incompatibility.
I've had my professor change the Java version from within the console window before. The code compiled just fine after he did so. I'm sure its the same case with this code.
After looking at other tutorials and google links I could only find command line approaches and #override methods. To be honest I still don't understand these.
What is the best way to change the version of a code originally written in an older code inside the eclipse console?
thanks!
In eclipse go to Window -> Preferences -> Java -> Compiler, there you can change the java versions. Hope it helps.
Ideally if we want to have two different versions of Java [say 1.6 and 1.7], then we should have two workspace defined accordingly to avoid any mixup. We can also change the Project Facets if our projects has facets that is.
In Eclipse Follow steps given below:
1) Windows -> Preferences -> Java -> Compiler and as per the image set the compliance compiler level as per your requirements.
2) Windows -> Preferences -> Java -> Installed JRE's and check if your required jre/jdk is available or not as given in image below:
3) Right Click on Your Project and go to Java Build Path and check if your required Library is available or not as per image given below:
4) Now you can edit the JRE System Library or add one by clicking on button's available on last image's right side, then a pop up as given below will open up. Here, you can change the execution environment [default values also can be set]
In myeclipse select the project -> properties -> java compiler -> there you can specify jdk version.
Easy
Download the jdk from Oracle's official website for the version you want to compile your project with.
JDK Oracle's official
create a new Java project
[
Once the project has been generated, If you select the part that says Configure JREs
By default eclipse will use the version you have installed on your system so if you don't change this configuration you will never be able to run the program with the build you need, in this case I will use jdk 1.8.
After pressing Add
5.1 And choose the option select the 3rd option in this case, called Standard VM and press Next
Now eclipse asks us to indicate the path where the libraries and other content is located in order to compile and run the program, we only have to indicate the directory where it is located.
As my goal is to run a program with the JRE 8 , I will look for the directory path where the download described in option 1 of this message is located.
As a quick example, since I just want my program to compile without worrying about anything else, I will add all the contents of my address.
Now we change by clicking on the JRE we want to compile our program, to be changed to the original default so that the new selection is executed ; and finally we press Apply and Close and Next
Press Finish to create the project
Now we have the whole project with all the necessary content to compile and run it.
Personally I think this is the quickest and cleanest way to do it ; the problem I encountered when I changed JDK is that when compiling I couldn't find the directory with the necessary components to run it, you had to download it and configure it together with the default parameters, which can cause a lot of headaches for less experienced users.
Finally, this is the version of eclipse that I am using
I hope you find this system useful, I use it to be able to run old examples that use applets , which are obsolete classes and jvm does not compile.

Categories

Resources