Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Eclipse build path parameters suitable for 2 computers(Eclipse settings on 2 different computers (both WIndows 10) do not allow to compile/run the source codes generated on the other machine)
Eclipse build path parameters suitable for 2 computers [message #1823203] Sun, 22 March 2020 13:54 Go to next message
Klaus Bangert is currently offline Klaus BangertFriend
Messages: 5
Registered: June 2019
Junior Member
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 06:12 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
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.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Eclipse build path parameters suitable for 2 computers [message #1823260 is a reply to message #1823222] Mon, 23 March 2020 18:53 Go to previous messageGo to next message
Klaus Bangert is currently offline Klaus BangertFriend
Messages: 5
Registered: June 2019
Junior Member
Dear Ed e.a.,

thanks so much for your response including the general statements about Java projects. Two further replies I cannot avoid:

1. Relative classpath:
Can I copy your example code into any classpath folder as is and what is right folder? Or is outside of Eclispe in Windows 10, where?. Can you give me a more precise advise. Sorry I am a stupid mechanical engineer...

2. Zip files Import-Export:
I have read a lot of different statements and would share your standpoint. The only problem is that if you import under the registry" Exisiting projects into Workspace" you have to delete all source code with identical file names to prevent errors when importing repetitively, or do you have a better recepee apart from GIT Hub?

Thanks so much for any further support.
Re: Eclipse build path parameters suitable for 2 computers [message #1823267 is a reply to message #1823260] Tue, 24 March 2020 03:46 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
For 1., I'm not sure what you asking. Your .classpath file does already contain a JRE_CONTAINER entry does it not? They key point is that whatever is in this file must be portable.

For 2., yes, you're pretty much stuck with deleting the folders because of course if there really has been any file deleted, unzipping files over top will not delete any files, only overwrite files or add files. Any process of copying/unzipping will involve deleting first, won't it?


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Eclipse build path parameters suitable for 2 computers [message #1823508 is a reply to message #1823267] Fri, 27 March 2020 18:34 Go to previous messageGo to next message
Klaus Bangert is currently offline Klaus BangertFriend
Messages: 5
Registered: June 2019
Junior Member
Dear Ed,

here attached you can see an exemplary snapshot of my classpath folder (snpashot attached). I think it contains references to JRE containers as wished/intended. Does it? On the 2nd PC (not used for this snapshot the jdk-8.0212.03 works fine for all JAVA source coudes generate on this machine. Therefore I loaded this JDK version up via Build path/external JARs to reslove my problem on this computer. Obviously without success. Can you provide some regerences/indications on which locations I need to impelement portable references. Can you recommend any book/tutorial that is sufficently detailed/conrete with example.

Alternatively: I do not want to spent 90% of my time to "domesticate" ELCIPSE. In ideal world I would use it as a black box. It seems your recommendation is GIT Hub. Do I need a MAVEN project as baseline test? Do you have some background information or additional recommendations. Anything is appreciated as this issue is pending since 6 months and I am alone on it and my "passion" is to learn Java and not ECLIPSE. Sorry for this useless stuff.

Regards Klaus
Re: Eclipse build path parameters suitable for 2 computers [message #1823521 is a reply to message #1823508] Sat, 28 March 2020 05:31 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
You have several JRE_CONTAINER entries. But for very reduced version of Java. Is that intentional? Normally one just has an entry like this:
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
And that makes everything in the JRE visible on the classpath. You can see what that is via Window -> Preferences -> Java -> Installed JREs and using Edit... to see the details. Aren't all the libraries you want visible there already?

But I see you've also got a module-info.java so you're using Java 9 or higher (or trying to, but then you appear to have a Java 8 JDK and asking for CDC- versions to Java to be visible). So I don't get what you're doing exactly or why you're doing it like that. Also you've added specific jars from a specific JRE, but I'm not sure why that's necessary.

Then I see you have *.class under a folder called "src" where I'd expect to see only *.java files. That seems very strange too.

In the end, looking at a .pdf image of the .classpath file's XML outline isn't all that informative to me. Better to attach the .classpath itself.

Somehow it seems you've made things more complicated than they normally would be. Perhaps reading this will help:

https://help.eclipse.org/2020-03/index.jsp?nav=%2F1

And then asking more specific questions on the JDT forum:

https://www.eclipse.org/forums/index.php/f/13/






Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Eclipse build path parameters suitable for 2 computers [message #1823656 is a reply to message #1823521] Mon, 30 March 2020 18:39 Go to previous message
Klaus Bangert is currently offline Klaus BangertFriend
Messages: 5
Registered: June 2019
Junior Member
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!
Previous Topic:Xtext grammar to java Code
Next Topic:Eclipse neon won't open
Goto Forum:
  


Current Time: Tue Apr 23 11:48:56 GMT 2024

Powered by FUDForum. Page generated in 0.08914 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top