Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » Eclipse Project for a Java Package?(How to setup an Eclipse project for a single Java Package)
Eclipse Project for a Java Package? [message #1837155] Fri, 22 January 2021 16:04 Go to next message
Eclipse UserFriend
Hello,
I am using Eclipse 2020-12 to construct a Java stand alone application [myJavaApp].

The application shall use a Java package [myPackage] which I intend to use on multiple Java stand alone apps. Therefore, I need to setup an Eclipse Project designed solely to produce the 'myPackage.jar' file that shall be used in my Java stand alone application Eclipse Projects.

Also, I would like to reference the package source file from a folder outside the Eclipse Project for Configuration Management purposes.

This seems like a very basic usage of Eclipse but I have been unable to get it right.

Actually,I had such an Eclipse Project setup nicely a few years ago but my Eclipse control files are among the missing.

Please advise or point me to some documentation that does what I need to do.
Regards,
Jim Crowell
Re: Eclipse Project for a Java Package? [message #1837165 is a reply to message #1837155] Sat, 23 January 2021 02:21 Go to previous messageGo to next message
Eclipse UserFriend
Hello,

To create a jar you can use export:

index.php/fa/39812/0/

index.php/fa/39813/0/

To reference a jar you can use the build path:

index.php/fa/39811/0/

index.php/fa/39810/0/

For documentation use search help for "export jar" , "Java Build Path"

Regards,
Eitan.

p.s.

If you use maven:

To reference a local jar :

index.php/fa/39814/0/


Re: Eclipse Project for a Java Package? [message #1837176 is a reply to message #1837165] Sat, 23 January 2021 11:14 Go to previous messageGo to next message
Eclipse UserFriend
Eitan,

Thanks for the quick response.
I kinda knew how to use the Java Package .jar in another Eclipse project but your info will be very helpful in gaining a better understanding.

My current problem is setting up the Eclipse Project that shall build the .jar file.
I'm sure I'm overlooking something intuitive.

I tried several things including a Java class which tried to use my Java Package that I do not recall having to do a couple years ago. That Class was OK but Eclipse told me that the Package did not exist.

I just need an Eclipse project that host my Package Java files, compiles them to give me Java errors and when everything is written properly constructs the jar.

A couple years ago I had this all working fine in developing an application that uses my package. When I need to correct or add to the package, I just made the changes in the 'Package' Eclipse project and then used the Java stand alone application Eclipse Project to continue my application development.

I have always had a problem setting up my Eclipse Projects but other than that I really like using Eclipse and it's debugger capability. Also, this time I am trying to work with the Java source outside the Project. In the past I could not get that working.

Thanks again,
Jim Crowell


Re: Eclipse Project for a Java Package? [message #1837177 is a reply to message #1837176] Sat, 23 January 2021 11:51 Go to previous messageGo to next message
Eclipse UserFriend
Hello,

Maybe I am missing something but it looks like you need a "new Java" project.

If you want you can set it up outside the default location (Eclipse workspace).

index.php/fa/39816/0/

If you want we can talk over WhatsApp (972-054-5661534)

Regards.
Re: Eclipse Project for a Java Package? [message #1837183 is a reply to message #1837177] Sat, 23 January 2021 13:38 Go to previous messageGo to next message
Eclipse UserFriend
Eitan,
Yes all I am looking for now is how to setup an Eclipse Project for my Java Package [jFormTK].

I followed you setup instructions [thanks] and got the attached result.

Note: I do not know how to include the screen show in this text? Therefore I made a .png and attached it [Eclipse_jFormTK_Package.png].

I have WhatsApp on my Mac but have never used it. I tried to use it, updated the .app file but it then asked me to process what looks like a Bar Code via my WhatsApp' application on my Android cell. When I tried to load WhatsApp on my cell I did not have room for it...

Anyway the .png image of my 'Package Explorer' did not look right to me. I think I need my external source files to be in an Eclipse Package?

Regards,

Jim Crowell
Re: Eclipse Project for a Java Package? [message #1837184 is a reply to message #1837183] Sat, 23 January 2021 13:57 Go to previous messageGo to next message
Eclipse UserFriend
Jim,

"I think I need my external source files to be in an Eclipse Package?"
True,

It should look like something like that:

index.php/fa/39819/0/

- create a package.
- move your code into the created package.

Regards,
Eitan.
Re: Eclipse Project for a Java Package? [message #1837187 is a reply to message #1837184] Sat, 23 January 2021 15:32 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

Attached is a image of my Package Explorer after doing what you suggested last.

It looks good me but I was surprised to see my package under the default package.
Is that right?

The error red flags I think are because I need to setup my external libraries in the Class Path.

Jim...

Re: Eclipse Project for a Java Package? [message #1837192 is a reply to message #1837187] Sun, 24 January 2021 01:49 Go to previous messageGo to next message
Eclipse UserFriend
Jim,

As far as I can tell from Attachment: PackageExplorer2.png your you need to create package com.jFormTk .

index.php/fa/39821/0/

This will create folders: com\jFormTk

index.php/fa/39823/0/

index.php/fa/39822/0/

You need to move ONLY *.java files from its current location to jFormTk

Regards.



Re: Eclipse Project for a Java Package? [message #1837327 is a reply to message #1837192] Wed, 27 January 2021 10:34 Go to previous messageGo to next message
Eclipse UserFriend
Hi,
I thought I had my Eclipse Project setup properly until I started to re-code some com.jFormTK classes. I was trying to have Eclipse use an external folder but with my current setup I have copied the external folder files into my Eclipse Project and it's .java files are updated.

First is the package setup in Eclipse proper as shown in attachment 'PackageExplorer3.png? It seems OK since the 'package com.jFormTK' statement' is not showing an error.

Second, ideally I would like to have the 'com.jFormTK' package source be using the 'sync.com.jFormTK'. folder on my HDD. 'sync' is from the 'sync.com' server side storage service. Yesterday, I tried several options from the Eclipse.Import feature but I did not find anyway to do what I want.

Why do I want to use an external source folder?
In my past Eclipse setup I would manually copy the Eclipse source folder to my 'sync.com' account at the end of the work day iff I had made any changes to my 'jFormTK' package. I am trying to eliminate this step by having Eclipse store my changes directly to my off-site storage service.

Below is not an Eclipse question so ignore it if I am out of line...
- Also, should I be using 'GitHub' in lieu of 'sync.com'?
Since I am a sole proprietor I have been avoiding 'Git' because I do not need to collaborate with anyone.

Regards,
Jim Crowell
Re: Eclipse Project for a Java Package? [message #1837330 is a reply to message #1837327] Wed, 27 January 2021 11:12 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

PackageExplorer3.png looks fine to me.

As I show in https://www.eclipse.org/forums/index.php?t=getfile&id=39816&

You can create you project any where you want.

For example I created a project under MyGoogleDrive so I can sync it up to the cloud.

index.php/fa/39840/0/

index.php/fa/39841/0/

Regards

[Updated on: Wed, 27 January 2021 11:15] by Moderator

Re: Eclipse Project for a Java Package? [message #1837331 is a reply to message #1837330] Wed, 27 January 2021 11:23 Go to previous messageGo to next message
Eclipse UserFriend
Hi

Allow me to assure you that a CM system is an absolute must for any developer.It provides invaluable backup and history.. GIT is a very good CM sytem and very suitable for one person development too.

You will find that a little time learning its capabilities are amply repaid.

I did not find it trivial to understand the GIT architecture. You might find https://wiki.eclipse.org/MDT/OCL/Dev/EGit helpful.

Regards

Ed Willink

[Updated on: Wed, 27 January 2021 11:28] by Moderator

Re: Eclipse Project for a Java Package? [message #1837332 is a reply to message #1837331] Wed, 27 January 2021 11:48 Go to previous messageGo to next message
Eclipse UserFriend
Hello,

I agree that that git is VERY important.

I even play a little with it.

However for me: 69+ old retired programmer that use Java as a hobby it is an over kill....

Regards.
Re: Eclipse Project for a Java Package? [message #1837334 is a reply to message #1837332] Wed, 27 January 2021 13:13 Go to previous messageGo to next message
Eclipse UserFriend
Hi

I'm only 63 but find that as I grow older I am more error prone / forgetful. GIT is a significant aid that you really should not ignore. Its overall capabilities may be overkill, but its basic capabilities are IMHO essential. If nothing else, it is just a backup from your working disk to whatever you use as your backup disk. But since GitHub is free you might as well make that in the cloud.

Regards

Ed Willink
Re: Eclipse Project for a Java Package? [message #1837340 is a reply to message #1837330] Wed, 27 January 2021 16:25 Go to previous messageGo to next message
Eclipse UserFriend
Thanks for the reply.

Your referenced link shows the Eclipse Project hosted on a different drive.
I actually never thought of doing that but perhaps I'll need to go that way.

In my case I have an existing Java Package that I now need to update and add a new capability. Ideally, I want to have the Java Package .java files external to the Eclipse Project which is hosted on my iMac HDD.

That way the Java Package .jar file shall be on my HDD where I will have a Java stand alone application Eclipse Project which uses my above package. In that Eclipse Project I will like to have the application .java files on my external drive.

I guess I could have both Eclipse Projects on my 'sync.com' off-site but if the above configuration is possible I'd feel in better control.

Regards,
Jim Crowell

Re: Eclipse Project for a Java Package? [message #1837341 is a reply to message #1837331] Wed, 27 January 2021 16:33 Go to previous messageGo to next message
Eclipse UserFriend
Thanks, I will look at the provided link.

Would Git take the place of my 'sync.com', i.e. is it dynamic in that as I compile a 'java class would it be dynamically written to the Git server?

Regards,

Jim Crowell
Re: Eclipse Project for a Java Package? [message #1837342 is a reply to message #1837334] Wed, 27 January 2021 16:40 Go to previous messageGo to next message
Eclipse UserFriend
Ed,

I am 83 and a few times I have caught myself writing the same Java code again thinking it was a new idea. Ouch!

Jim...
Re: Eclipse Project for a Java Package? [message #1837347 is a reply to message #1837342] Wed, 27 January 2021 21:48 Go to previous messageGo to next message
Eclipse UserFriend
Hi folks,

Interesting meeting place for the elderly.....

Regards.

p.s. Jim is that you ? http://jimcrowell.com/resume.html

and this is me https://people.sap.com/rosenberg.eitan
Re: Eclipse Project for a Java Package? [message #1837363 is a reply to message #1837347] Thu, 28 January 2021 09:19 Go to previous messageGo to next message
Eclipse UserFriend
Eitan,

Yes that is my web page and resume. Needs some updating however.

I followed your link and looked for an Email address for you.

I would like to know more about 'SAP'.

Jim...
Re: Eclipse Project for a Java Package? [message #1837368 is a reply to message #1837363] Thu, 28 January 2021 10:30 Go to previous messageGo to next message
Eclipse UserFriend
Jim,

Found your Email and will use it.

Regards
Re: Eclipse Project for a Java Package? [message #1837428 is a reply to message #1837368] Fri, 29 January 2021 13:04 Go to previous messageGo to next message
Eclipse UserFriend

Status:

I ordered a book for Java 9+ and will work my way through. In the meantime, I have back tracked to Jave 1.8 so that I can keep my project moving forward. I hope to be done in the early spring and I don't want to use my time now to address Java 9+ issues.

I'm closing this thread.

Jim A.
Re: Eclipse Project for a Java Package? [message #1837429 is a reply to message #1837428] Fri, 29 January 2021 13:06 Go to previous messageGo to next message
Eclipse UserFriend
Oops. I'm sorry - this is not my thread. Please excuse my previous message.
Re: Eclipse Project for a Java Package? [message #1837528 is a reply to message #1837429] Mon, 01 February 2021 15:07 Go to previous messageGo to next message
Eclipse UserFriend
I want thank everyone who has contributed to this thread. Bottom line is that I still can not get my Eclipse Project working and I will next try Visual Studio 'code' to see if I will have better luck.

Originally, I was going to use Visual Studio 'code' because I recently used it on a nodeJS and on a HTML effort and really like it. But I went back to Eclipse because that is how I developed the first version of the Java Package and the Java stand alone applications I need to revise.

I also appreciated the advise on GIT. I read up on it and will use it soon. I think I will only do commits once I get an IDE setup and hopefully once I have written and tested my Java Package revisions, i.e. a before and after archive.

I wish I had used it in my earlier development phase. Perhaps, if I had done so, I would not be having my setup problems.

Regards,
Jim...
Re: Eclipse Project for a Java Package? [message #1837542 is a reply to message #1837528] Tue, 02 February 2021 00:07 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

Best of luck.

If you still need any help you can mail me (I sent you a mail using the mail I found on your web page ).

Regards.
Re: Eclipse Project for a Java Package? [message #1837576 is a reply to message #1837542] Tue, 02 February 2021 11:32 Go to previous messageGo to next message
Eclipse UserFriend
Eitan,
I did not receive your Email?
I just sent myself a 'test' Email from my web site's 'Email' button and it worked fine? Does the Email address you are using end with "@EMail.com"?

I have been trying to set up my Eclipse Project in my 'Sync' folder. I also set my Project workspace in the 'Sync' folder although I wanted it on my iMac root 'jim' folder. After creating the ' jFormTK_Package' I tried multiple times to create a new Project for my package [com. jFormTK] but it always resulted in a 'com/jFormTK' folder new in my Package Explorer, i.e. no package icon showed in the Package_Explorer???

Actually, a big step backwards since It was being setup properly in the past.

Eventually I thought that was maybe OK so I proceeded to try to use it but I got an error on all my .java files on the 'package com. jFormTK' statement.

This morning I tried to recreate the above so I could make a screen shot for this conversation. But I received yet a new Eclipse error as shown in the 'Eclipse2_2_21.png' attachment.

Frustrating but I am sure I am doing something real stupid somewhere.

Regards,
Jim...
Re: Eclipse Project for a Java Package? [message #1837577 is a reply to message #1837576] Tue, 02 February 2021 11:43 Go to previous messageGo to next message
Eclipse UserFriend
Jim,

Please check you mail...

Regards.
Re: Eclipse Project for a Java Package? [message #1837578 is a reply to message #1837577] Tue, 02 February 2021 11:52 Go to previous message
Eclipse UserFriend
I just checked my Email but nothing there from you???
Previous Topic:How do you exclude a package in an external JAR?
Next Topic:JDT source cleanup command line
Goto Forum:
  


Current Time: Sun Oct 19 05:00:28 EDT 2025

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

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

Back to the top