Monday, February 1, 2016

Create, Build & Run - Intellij / Java / Mac - #NLProc code

Today we are going to have a basic NLProc application written using the following
1. Java in Intellij
2. MAC OS
3. Stanford CoreNLP modules.

We will follow these basic 3 steps in writing an enterprise level code with design & folder structures.

I personally had to go through a lot of websites and peer Q&A to understand these bits over the last few months and hence sharing these details to all of you out there.

Let me make this point first. I am a algorithm / back end person and most of my work is written as functions. We don't have web-app in our end of coding. Hence a typical design pattern does not fit our requirement.
Having said that, I do follow the interface and implementation format of java design patterns when and where required.

Maven folder structure -
http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html

1. Create - Code development.
2. Build
2.1 Build jar with dependencies in Intellij
 https://www.jetbrains.com/idea/help/packaging-a-module-into-a-jar-file.html

Make sure your MANIFEST.MF is in:
src/main/resources/META_INF/

Now If I try to run jar using:
java -jar path_to_jar/jar_file
3. Run
3.1 Shell scripts
All u have to do is call this jar with full path from shell script like this
java -jar path_to_sample/sample.jar > sample.log 2>&1 &
last "&" means that process will run in background

and 2>&1 means that even errors will be redirected to "&1" which is ur standard ouput...console.. now this too will get written in our log file

P.S This blog is WIP. Will provide steps and screenshots more in detail soon.

No comments:

Post a Comment