Eclipse build path parameters suitable for 2 computers [message #1823203] |
Sun, 22 March 2020 09:54  |
Eclipse User |
|
|
|
Dear all,
I am trying to learn autonmously Java based on Eclispe 9.6 and I have two Windows 10 computers both equipped with identical Eclipse and separate local workspaces on their harddrives and try to keep them up to date through (1) USB stick and/or Dropbox (2). At the end of the day (since months) each time the data transfer is a mess and I have not understood why (error message main class not found, Java.lang missing) occurs. Current Eclipse version is 201906 with ID 20190614-1200. The different JREs and JDKs I tried to enlarge to variable pathes according to the attached screenshot without auccess. I have read one eclipse book from Thomas Kuenneth, but did never find a sound and structured explanation of how (classpath, libaries, JAR files) should be arranged to get it work for 2 different PCs. Can anybody provide me sound and simple approach or a tutorial with practical examples to resolve my issue (main class not or missing reference to JAVA.lang, or imports not found?) I am willing to follow any concept, do any re-arrangement. Thanks in advance.
|
|
|
Re: Eclipse build path parameters suitable for 2 computers [message #1823222 is a reply to message #1823203] |
Mon, 23 March 2020 02:12   |
Eclipse User |
|
|
|
This question is quite specific to the Java Development Tools support so probably best asked on the JDT forum:
https://www.eclipse.org/forums/index.php/f/13/
I'm not sure what advice they'll give but here's the general idea. The information about the classpath is stored in a file that is generally hidden by default. I.e., each Java project will have a .classpath file. To view such files directly, you can use the Package Explorer view menu to disable the ".* resources" filter. In general this file (and hence the project) is only portable across machines if there are no classpath entries with absolute paths that are specific to the machine. Generally the paths related to the JRE use (and should use), symbolic entries, e.g., <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> This ensures that the actual path is resolved using the JRE configured in the preferences, i.e., Window -> Preferences -> Java -> Installed JREs. If you need to add additional jars, it's best to put them in a Java Project and export them to make them available in other Java projects.
In addition, you should assume that a workspace folder is not portable . Assume that you cannot copy it from one place on a computer to another or from one computer to another. There's all kinds of "stuff" in the workspace's .metadata folder and some of that stuff contains absolute paths that will not work in another location or relative paths that will not work on another location even on the same machine. To "share" projects, it's best export them to a zip file and import them into a workspace. Or better yet, share them in a Git repository and push/pull the changes.
|
|
|
|
|
|
|
Re: Eclipse build path parameters suitable for 2 computers [message #1823656 is a reply to message #1823521] |
Mon, 30 March 2020 14:39  |
Eclipse User |
|
|
|
Hi Ed,
last reply:
neither me does know exactly what I am doing. I did try and error on the JDKs,JREs. I am on Java 9 (due to automatic updates) but just doing ordinary programming. I only want this system to run reliable. Is there a simple recommendation to intstall one JDK and with which reference. I am willing to work through the Eclipse help tutorial but are afraid to loose track. What do you think about a complete re-install of Eclipse Java 9 or 8 if still available and afterwards re-import the source files on both machines. Might resolve the issue with the JDK/JRE and the stupid project strcuture can be corrected as well? Thanks if you have a last recommendation.
By the the way attached is a pdf (classpath continued) with the details of both of the classpath entries obtained in accordance to your advise. Unfortunately they look different when compared to your example and I cannot draw a conclusion -new and different to JAVA 8 and not relative but absolute as "<" are missing?.
Rem:
I would love to send something different to pdf, but where do I have to take take these files from C:\Program Files\AdoptOpenJDK?
Thanks for your time and expertise, indeed!
|
|
|
Powered by
FUDForum. Page generated in 0.09970 seconds