Running a project built in docker in Eclipse - java

Sorry if I am being ignorant but I am quite confused on
How to run this project in eclipse:
https://github.com/ivanlomba/taboleiro
It was packed with docker and I have no experience with it whatsoever.
If anyone could help me out it would be great!

I'm not an Eclipse user, but It's a Spring Boot application and uses Maven as build tool, so you can import the project (files inside code folder) as "Existing maven project". There are tons of tutorials about creating/importing a Spring Boot project with Eclipse and Maven if you have any doubts.
If you don't use Docker you will need to configure the mysql database manually. You can find the schema of the database inside resources folder.

Docker part is only to deploy. Search for how to set up environment variables in your OS.
get Java 8 or newer, make sure the folder above bin of Java is defined as JAVA_HOME (like if your javac.exe path is "c:\program files\java\java8_121\bin\javac.exe" then JAVA_HOME="c:\program files\java\java8_121" without slash in the end
Download maven, unzip to a folder like c:\apps\maven then add the parent of the bin folder as MAVEN_HOME
like MAVEN_HOME=c:\apps\maven\maven_4_xyz
Change the PATH variable to be
PATH=%JAVA_HOME%\bin;%MAVEN_HOME%\bin;%PATH%
Now in termimal cd to the code folder of where you have cloned or unzipped https://github.com/ivanlomba/taboleiro/tree/master/code then give the commands
mvn install
mvn test
Now in IDE install maven plugin too if its not there, then can import as an existing maven project.
If your in linux change the paths to
MAVEN_HOME=/path/maven_4_xyz
and
export PATH=$JAVA_HOME/bin:$GRADLE_HOME/bin:$MVN_HOME/bin:$PATH
in ~/.profile or other place

Related

Getting other Java project JARs into Docker image?

I have a Quarkus project that uses some other common code from another Java project that I use mvn install on so it has access to it locally. Within Quarkus applications theres a Dockerfile.jvm that you can use to build the Docker image. The question is how do I get this other project into the Quarkus application's Docker image that I want to use? If I use mvn package and copy the JAR files into the target/ folder it doesn't seem to get picked up so I'm not sure what other ways to try this. Do I need to maybe copy the JARs into the target/ folder and then run use a mvn install from that path or something?

How to export JavaFX gradle project as a standalone executable file for deployment?

I have completed my JavaFX application within gradle build system, and it is working fine in all way. Now I want to export as a .EXE file for standalone software distribution, I tried much more tricks but no gain. If some one can help me out to wrap my project in a software setup, It would be grateful.
Follow these steps to export your JavaFX project into executable Jar
Goto> Project Structure
Goto>>Artifacts
Click "+">> To add new artifact
It will shows a dropdownlist
Select>>Jar>>From module with dependencies
You will see a nested window as shown
Select Main class of your project
Check In the Option " Copy to output directory.." >>Ok
Goto>> Menu-bar>>Build>>Build Artifacts
Select>> your Project.jar>> Build
This will create executable jar file in your project source folder
Locate your jar file in path project\out\artifacts..
Now you can run this jar file simple cmd commad or with batch file
Cmd Command>> Java -jar project.jar
Using batch file>> make .bat file name it "RUN" and write these commands inside
Specify the Java Runtime path and "Javafx Sdk path" along with VM
options & Project Jar
Run your standalone application .. Enjoy ;)
Creating an installer for the desktop platforms (Windows, macOS, Linux) has become easy these days. The tool of choice is jpackage which started to be shipped with JDK 14. It can either be used on the command line on the finished project or you can use a Gradle plugin (https://github.com/beryx/badass-jlink-plugin). If your project is not modularized you could follow this tutorial https://github.com/dlemmermann/JPackageScriptFX which also uses jpackage but together with Maven and some other tools from the JDK. The Maven part could easily be rewritten to Gradle, if needed.

How to Install & Deploy a java app (.jsp file) in apache tomcat

I have successfully installed apache tomcat & verified it to be working using the curl command
curl http://localhost:8080/
Tomcat is installed in
/var/lib/tomcat8/
webapps/ROOT/index.html
webapps/ROOT/META-INF
lib
I have received following structure of the java app in a zip file
App/
build.xml
deploy.sh
run.sh
www/
*.jsp files
WEB-INF/lib/*.jar files
I want to install and run this app on my server. How can I do that. Specifically I want to know where to place these folders. Do I need to run any of the deploy or build files. Do i need to install the jar files? If I directly run one of the .jsp files from curl command, it crashes due to missing java class.
Perhaps I am missing something obvious but I am new to java env and could not find it from google.
If you haven't tried it yet, consider using Maven to build your projects.
This will automate and simplify a lot of similar work for you, like creating a .war file and deploying your project to Tomcat. With Maven, you have to set the <packaging>war</packaging> in pom.xml (a project configuration file) and run mvn tomcat7:deploy command.
For details look at the above link to Maven docs or for instance check out this tutorial.
You can also use the Tomcat Manager under (default) http://localhost:8080/manager to deploy the .war file manually.

migration an Maven projet from eclipse to a command line environment

I got an Maven project which is compiled in Eclipse. Now I need to migrate it to a Linux environment, and there won't be GUI interface I can use. I wonder what I should do to migrate it?
Currently , under Eclipse project folder I have the files/folders as the below:
.classpath
.project
.settings
.springBeans
doc
pom.xml
src
target
I figure all those .* folders are Eclipse meta data. so I can remove them. Then I can use the rest to form a Maven project that I can build using Maven command lines?
For a maven project to work command line, all you need is
Maven is installed and correctly exported in the $PATH variable
The pom.xml in your workspace.
Just go to the project directory and run mvn install.
mvn clean
then remove .project .classpath
if you want to lose eclipse project settings while migrating delete .settings (assuming it doesn't have machine specific path/settings)
copy rest to new linux environment
open eclipse, import project as maven project (assuming you have new eclipse with maven plugin setup on linux environment)
Note:
make sure you still have a backup before you successfully migrate over
.classpath contains references to local .m2 when used with eclipse and maven so the path would differ in linux and would create issue
.project contains some configuration that is eclipse maven plugin dependent, so it is good to loose it once and let new environment create new one

problems deploying a maven application with mvn command

I have a maven application under eclipse . The jsp pages and WEB-INF folder are located under the path NomeMiaApplicazione\src\main\webapp. I run these commands : mvn clean ,
mvn eclipse: eclipse and mvn compile under the root folder of the application, and in all three cases, the build is successful. However when I access the folder ( into the workspace )
. metadata.plugins\org.eclipse.wst.server.core\tmp2\wtpwebapps\NomeMiaApplicazione
, there are no jsp pages . what would be the solution for this problem ? thks !
It is necessary to clarify the role of the commands you used and their impact on Eclipse.
The mvn eclipse:eclipse command creates the Eclipse project files, in order to save you the hassle of configuring a new project and identifying all the sources for it. This command is also equivalent to creating a new Eclipse project from an existing Maven project using the m2e Eclipse plugin. See also this page regarding the eclipse:eclipse command. That being said, you only need to run such command once, and then import the resulting project into Eclipse.
Secondarily, mvn compile builds your source files into the target directory of your NomeMiaApplicazione root folder. This command does not involve Eclipse in any way. Also, web resources are still not packaged. To package them, you need to issue mvn package: you will then find the <artifact>-<version>.war file again under target, and the pre-packaged content under target\<artifact>-<version>. Beware that, in order to account for the webapp content, your Maven packaging must be of type war. Check the pom.xml for the <packaging> tag.
Finally, deployment is still another issue. If you actually need to move your .war file from the target directory to somewhere else (namely, an autodeploy folder of a servlet container), you can configure the Maven Deploy Plugin and issue mvn deploy. I'd rather suggest you to search SO for deploy war eclipse and/or deploy war maven, since there's plenty of related stuff. In the first case, you will find how to use Eclipse as a facility for deployment, while the second case leverages the command line to provide a more portable/flexible deployment procedure.
That's because mvn compile ends on compile phase of Maven's default lifecycle. Do mvn package and check then. And by the way, default Maven output directory is target so rather check it instead of kind of WTP temporary dirs.

Categories

Resources