intellij module/project with android and java sources - java

I am having an annoying problem with organising my sources. We have a client server application with the server written in java and android as the client. The repository contains all the server files in one folder and all the android specific stuff in another at the top level.The Android folder however is not complete since it needs some files that exist in the server folder. I need a way to pull down the all the necessary files from 2 separate folders in my repo all in to one Intellij module/project.
My colleagues using eclipse were able to solve this by creating an android project, downloading the android source files from the repo and then using the add to build path > link source feature. This created symbolic links in the android project to the necessary files in the server folder so that android could compile.
How do i achieve this in Intellij? I hope this is clear but it is quite hard to explain. Thanks.
Also if this matters i am using SVN.

Related

What to push to Git?

I'm gaining my first experience with Git and its hosting platforms (GitHub etc).
Say, I create a JSP project in Eclipse with some custom files (*.jsp and *.java) and a bunch of auto-generated project files. I need to install an application server as well.
This is an example JSP project in Eclipse. Only the yellow marked files were generated by me:
My colleague wants to contribute to that project. I don't know, what system and what IDE he is going to use.
What exactly do I need to push to Git?
Are only my own files enough? Or do I need to push the entire project, including the files generated by Eclipse?
What if my colleague uses a different operating system, IDE or application server?
Would it make sense to only push the following files?
StudentsBean.java
index.jsp
How would he then need to import them, so that they become executable?
Try creating a new repo and then while creating a repo select git ignore file and type of that file is java or jsp. Then while pushing it will automatically ignore files which are not needed.

From .jar to importable package... How?

I have a .jar file that is sitting in one of my folders after I downloaded it from a tutorial website. This .jar file includes all of the necessary packages needed to be imported to a specific program I wish to run (i.e., it is a client that allows me to communicate with the server I need to use for this project), but I don't know how to transfer the .jar file into a package so that I can directly import the necessary packages for this project. Do I have to transfer the file into a Maven repository (which I have no idea how to do) or do I have to use some hidden technique to transfer the file over so I can import directly from the file? Or is it a really quick fix that just takes two minutes?
F.Y.I.:
I am using NetBeans IDE 8.1 for the said-Java project.
I am not heavily experienced with all the ins-and-outs of the IDE, so I need simple instructions.
I barely understand what a Maven repository is or does. I only have heard of a Maven repo through "Help" websites.
I have tried multiple "Help/fix-it" sites but only got vague answers, like "run 'make'".
My response: How does one 'make'? Their response: ...

Syncing project to github does not sync java source files

I am writing an android app using Android Studio, and I am trying to sync it to github. I have tried through the GUI VCS menu and through terminal, but both have resulted in the directory where my .java files should be turning into what seems to be a file I cannot open in github. So, my source files should be in ~/BrainGames/app/src/main/java/com/example/root/braingames/, but github creates a file at ~/BrainGames/app/src/main/java/com/example/root/ called braingames and this file cannot be opened to see the source files. I have tried remaking the repository through github and through Android Studio and I have tried syncing many times. I have no idea what I am doing wrong.
You should check your project directory, check all the files. If you have a Mac do ls -a -l. Check to see if you have multiple .git files, if you do, delete one of them. If you have multiple, it can cause this problem.

JavaEE compiling files

I feel like a 4-year old who has a slice of bread with pb and a slice with jelly and is asking how to make a sandwich..
I've been given the responsibility of maintaining a javaEE website that was done by our parent company that no loner supports us. I'm relatively new to JavaEE and I'm trying to figure out how to recompile the files that need to be modified from within the root folder of the site.
I downloaded NetBeans to help me with this, but still can't figure it out. My problem is that the java files can't find any of the packages and resources they are dependent on. As far as I know, the resources are there.. although, I do see some packages starting with "com." and "javax.", and I don't see a 'com' or 'javax' folder anywhere.. I believe my problem has something to do with setting the class path in the project properties in NetBeans.. I tried that but either I'm not doing it right, or its not working. This whole Java compilation is so foreign to me, it'd be really great if someone could lead me in the right direction of getting this website compiled.
I posted a pick of the folder hierarchy of the website to help:
I'm trying to compile the RecordAdd.java file here specifically at the moment. Some of the packages it is trying to import come from its parent folder, asp, of the folder it is in, easp. The file is also trying to import com.icesoft.faces.component.*; where '*' consists of several different imports of the parent packages. I don't see a com folder like I mentioned, but I do see icefaces.jar files in the lib folder in WEB-INF folder. I've tried putting these folders in NetBeans Library-Compile category classpath, but that didn't do anything.
I'm not doing something right, that is probably a basic knowledge of compiling java projects, but I'm just not getting it. I really appreciate any help, just please don't be too harsh. Thanks!
Try to find out which IDE the original devs used. I see a nbproject folder which indicated Netbeans (unless that was created by you) so try opening the project in Netbeans as a Java EE project. I'd also try to open it in Eclipse, it has good importing capabilities and can sometimes figure out the classpath on it's own. Download the Java EE version of Eclipse and install the Web Tools Project. You can also try to see if there is a build file that will compile and generate a war file for you (something like build.xml).
It should be simple if the project was created in netbeans. Just go to File -> Open Project. Navigate to where the project is located. You will know if the folder is a project, because netbeans recognizes it and a different icon is displayed instead of a regular folder icon. Once you open your project, you can right click compile the project.
You don't use java compiler yourself to compile java files in a project. Compiling and building are done by tools like ant, maven... It's automated.
Importing existing projects into netbeans is a great way to loose a half a day.
I'm assuming that since there's a nbproject directory, this was built through netbeans, which should give you a leg up.
In the "Open Project" wizard, the top level of your application (not necessarily the sources) should have a friendly globe icon for a web application (.war) or a triangle for EE application (.ear). Open the triangle if there is one. Web applications can be packaged with EE applications through netbeans, so if the Web App you're trying to compile belongs to one, some of the build properties may be associated with it.
Looking at the file nbproject/build-impl.xml should give you hints about where your libraries folder was located. Make sure this path matches in your project properties under the Libraries header. These libraries can be shared among projects and therefore likely out of this projects directory structure and referenced or native to this project alone in which case jars are copied in to your lib folder.
There may be additional reference or server issues that netbeans detects (and gives a paltry error message for) which can be found in the project context menu under "Resolve Reference Issues" or "Resolve Missing Server". In netbeans projects are built against the servers they're run on right in the IDE. Check that you have the servers you want configured under Tools-> Servers, then ensure that server is linked in your project properties under Run.
This may not solve all your problems, but is a good start. Good Luck!

How do I install org.apache.commons.code.binary.Base64?

I am taking a class on Android and I am a newbie with JDeveloper. I am working on a Web Services application. I downloaded some code that has a "Import org.apache.commons.binary.Base64". JDeveloper is barking "not found" for this import. I found on the apache website the org.apache.commons.binary.Base64 module and downloaded it. What do I do now? I am not sure how or where to place this code. The downloaded folder has several folders and and way down at the bottom of one of them is my Base64 module. Sorry for such a basic question. I am using JDeveloper 11g 11.1.1.0.2 running on Windows 7.
If you downloaded the source, which is just Base64.java, just add it to your project as
org/apache/commons/binary/Base64.java
If you downloaded a jar, add that to your project classpath. In JDeveloper this should be available from the project properties dialog and select "Libraries\Classpath".
Of course, if you distribute this project it will need to adhere to the Apache license.

Categories