Java Package Development Project(s) design?
Answered
I am developing a Java package and I need advice on how to setup the IDEA project(s). Previously, on Eclipse, I setup 2 projects as follows:
1. Project for the package, e.g. "com.myPackage".
2. A Java stand alone application project using my 'com.myPackage' package.
I have been making changes to the 'com.myPackage' package in Project 1 and then using Project 2 to test the revised package.
Eventually, I plan to use my 'com.myPackage' package in several stand alone Java applications with an IDEA project for each new.
I wonder if the above use of Projects is acceptable or have I been missing something on how to use a Java IDE.
Regards,
Jim...
Please sign in to leave a comment.
Please see https://www.jetbrains.com/help/idea/migrating-from-eclipse-to-intellij-idea.html .
You will use Modules instead of Projects in IntelliJ IDEA.
A module can be reused in multiple projects.
Thanks Serge. I visited that link last night and will go to it this afternoon.
Regards,
Jim…
OK. Please let me see if I understand how to use Projects and Modules in IntelliJ IDEA...
1) I shall produce a Module [moduleMyPackage] that contains and controls my Java Package,
i.e. the package .java files, .jar file and images folder..
2) For each application that uses [moduleMyPackage] I construct a Project that reference the
'moduleMyPackage' module and a module that contain the application specific source code, images, etc.
Questions :
- Are the above usages correct?
- Can a 'module' be created as a stand alone module [step 1] OR does a module have to be constructed inside a Project?
Regards,
Jim…
Module can be only created within a project. Your understanding is correct.
Thanks again.
Regards,
Jim…
In trying to setup a Project with a Module for my package [com.jFormTK] I ran into a problem when opening the first 'com.jFormTK' method into the editor. I must not have the package setup properly plus there is a source code encoding problem that my Google searching has not found a solution for...
I have some documentation that suggest I place the mouse cursor within the package name, press Alt | enter and then elect "Move to package 'com.jFormTK'".
This does not produce the required option and is perhaps masked by the encoding problem.
Attached is a screen shot that may help you to get me setup properly.
Regards,
Jim…
The package seems to be correct. What suggestions do you get when you Alt+Enter on the underlined package statement? What does Ctrl+F1 display for it?
Your file may be in some lossy encoding and you need to configure the project encodings to match the actual file encoding, see http://blogs.jetbrains.com/idea/2013/03/use-the-utf-8-luke-file-encodings-in-intellij-idea/.
Serge
Based on the blog link that you provided I think the system is finding some [one or more] non-UTF-8 characters and presents the "File was loaded in the wrong encoding: 'UTF-8'" message. If I select the settings "Fix all 'Lossy encoding problems'..." list item, then delete the Editor TAB, then reload the editor TAB the error goes away.
Hopefully you can suggest a project level fix for the above because my package has many methods.
The "package name does not correspond to the file path 'jFormTK'..." message will eventually respond to the 'Alt | enter' keys with the expected "Move to package 'com.jFormTK'" option but only after multiple tries where the response 's a "Create Test" popup???
The ctrl | F1 does nothing, i.e. no pop-ups occur.
This seems like an IntelliJ bug in that the same key combinations produce different results!
I am trying IntelliJ IDEA because of my dis-satisfaction with the Eclipse Project setup and the glowing positive reviews I have read on IJ.Over the last few days I have read a-lot and viewed several YouTube video's. i was really looking forward to using the IJ IDE but will most likely go back to Eclipse since I am way behind in my package development phase and the IJ learning curve is steeper than I thought it would be.
If you can suggest other "Project" level things I can do to resolve my issues I will certainly try them in parallel with trying the latest Eclipse...
Regards,
Jim...
Configure the encoding per file or per directory to match the actual encoding of your files.
Other issues are not clear without a sample project, you can share one via https://intellij-support.jetbrains.com/hc/articles/206869619.